user5638730 user5638730 - 1 month ago 22
Git Question

GitHub Laravel App Sync

I just created a Laravel App (I'm completely new to Laravel and also don't have so much experience with Git(Hub)).

I created it locally on my computer with the

composer require "laravel/installer"
command and then ran
composer create-project
. I also added authentification with new table rows (migration) etc, downloaded some things and e.g. donwloaded another language pack.

Now I uploaded everything to GitHub, except the things that are in .gitignore (that looks like the following):

# Created by .ignore support plugin (hsz.mobi)
### Laravel template
vendor/
node_modules/

# Laravel 4 specific
bootstrap/compiled.php
app/storage/

# Laravel 5 & Lumen specific
bootstrap/cache/
.env.*.php
.env.php
.env

# Rocketeer PHP task runner and deployment package. https://github.com/rocketeers/rocketeer
.rocketeer/
### Composer template
composer.phar
/vendor/

# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
# composer.lock
.gitignore
.idea/


Basically what I tried on another computer now, was running composer install and then a php artisan migrate (to get the databases). But this didn't work. There where quite some errors, what I at least noticed was that I still got a
.env.example
instead of a
.env
. So there was a
env.example
uploaded instead of a
.env
, is this correct?

However, whats the best practice or a good way to achieve what I want? Normally I'm working on the project on the computer I created the app, but sometimes I also want to work on and test something on another computer, so I need a local instace. After pushing everything to Github, what do I have to do on another copmuter to get my app running?

PS: I'm using Laravel 5.3

Answer

As @TimL said in the comments this will be because you're .env file won't have been set up. You're .env-example is there for you to copy to make life easier.

You can either copy and paste it over, or if you using the command line:

cp .env-example .env

Then you populate it with the details for that environment.

Finally, to generate your application key just run the command:

php artisan key:generate

and this will generate the key for you.

The only other manual thing I can think of it creating the database before you use migrate.

Hope this helps!

Comments