问题
I'm new to github and I found this site very useful for lot of us. I came up on storing my laravel project here in github, but theres a problem every time I will clone it to be able to go to production, when im about to clone it at first, it always show this error.
Warning: require(C:\xampp\htdocs\tourismPortal\bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\tourismPortal\bootstrap\autoload.php on line 17
Fatal error: require(): Failed opening required 'C:\xampp\htdocs\tourismPortal\bootstrap/../vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\tourismPortal\bootstrap\autoload.php on line 17
I know this will solved by using composer update on it, but is there any way to prevent this error so that every time I clone it, I will go to production without encountering this error? Thanks, by the way I'm using tortoisegit
to clone, pull and push.
回答1:
Yes you can, but that is not recommended at all.
You can delete everything in .gitignore
file and push them from a working project. Then it will work perfectly where you git clone
them.
But there are so many drawbacks in this way. I recommend you not to do that.
回答2:
- Clone your project
- Go to the folder application using
cd
command on your cmd or terminal - Run
composer install
on your cmd or terminal - Copy
.env.example
file to.env
on the root folder. You can typecopy .env.example .env
if using command prompt Windows orcp .env.example .env
if using terminal, Ubuntu - Open your
.env
file and change the database name (DB_DATABASE
) to whatever you have, username (DB_USERNAME
) and password (DB_PASSWORD
) field correspond to your configuration.
By default, the username isroot
and you can leave the password field empty. (This is for Xampp)
By default, the username isroot
and password is alsoroot
. (This is for Lamp) - Run
php artisan key:generate
- Run
php artisan migrate
- Run
php artisan serve
- Go to localhost:8000
回答3:
Run the following commands:
git clone --single-branch --branch [TAG_VERSION] https://github.com/laravel/laravel.git [CUSTOM_PROJECT_NAME]
composer install
来源:https://stackoverflow.com/questions/38602321/cloning-laravel-project-from-github