Skip to content

Instantly share code, notes, and snippets.

@Bazsmagister
Last active July 3, 2024 12:18
Show Gist options
  • Save Bazsmagister/a8aab6c165f3b6488e3819ae78efd650 to your computer and use it in GitHub Desktop.
Save Bazsmagister/a8aab6c165f3b6488e3819ae78efd650 to your computer and use it in GitHub Desktop.
How to install a cloned laravel repo, and make it work.

In terminal cd into the dir, where you want to clone the selected repo.

git clone https://github.com/[REPOUSE]/[REPONAME].git

for example:

(git clone https://github.com/Bazsmagister/WordChain.git)

cd [REPONAME]

composer install

//on linux

cp .env.example .env

//on windows

copy .env.example .env

edit .env file with database credentials(mysql, or any)

if using "barryvdh/laravel-debugbar" package put into .env:

in development:

APP_DEBUG=true

when in production:

APP_DEBUG=false

php artisan key:generate

php artisan migrate:fresh --seed

php artisan serve

In terminal cd into the dir, where you want to clone the selected repo.
git clone https://github.com/[REPOUSER]/[REPONAME].git
for example:
(git clone https://github.com/Bazsmagister/WordChain.git)
cd [into_the_cloned_repo]
composer install
//linux
cp .env.example .env
//windows
copy .env.example .env
edit .env file with database credentials
php artisan key:generate
php artisan migrate
php artisan serve
----
If creating a new repo:
1. Create a new repo on github -> no readme, nothing at all.
2. Create a project on local machine. (laravel new anything)
3. cd anything
4. git init
5. git add all
6. git commit -m "first commit"
7. git branch -M main
8. git remote add origin https://github.com/Bazsmagister/[your_repo_name].git //change repo name
9. git push -u origin main
// the above is the same as this: git push origin main ; git branch --set-upstream main origin/main
//https://stackoverflow.com/questions/5697750/what-exactly-does-the-u-do-git-push-u-origin-master-vs-git-push-origin-ma
Technically, the -u flag adds a tracking reference to the upstream server you are pushing to.
What is important here is that this lets you do a git pull without supplying any more arguments.
For example, once you do a
git push -u origin master
you can later call git pull and git will know that you actually meant
git pull origin master
Otherwise, you'd have to type in the whole command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment