php 从github克隆laravel项目
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/38602321/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
cloning laravel project from github
提问by S. Domeng
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.
我是 github 的新手,我发现这个网站对我们很多人都非常有用。我想将我的 Laravel 项目存储在 github 中,但是每次我克隆它以便能够投入生产时都会出现问题,当我一开始要克隆它时,它总是显示此错误。
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.
我知道这将通过在其上使用 composer update 来解决,但是有什么方法可以防止此错误,以便每次克隆它时,我都会在不遇到此错误的情况下进行生产?谢谢,顺便说一下,我tortoisegit
用来克隆、拉和推。
采纳答案by Rafik Farhad
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.
您可以删除.gitignore
文件中的所有内容并将它们从工作项目中推送。然后它会在你git clone
他们的地方完美地工作。
But there are so many drawbacks in this way. I recommend you not to do that.
但是这种方式有很多弊端。我建议你不要这样做。
回答by Conor
- 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
- 克隆你的项目
- 使用
cd
cmd 或终端上的命令转到文件夹应用程序 composer install
在你的 cmd 或终端上运行- 将
.env.example
文件复制到.env
根文件夹上。copy .env.example .env
如果使用命令提示符 Windows 或cp .env.example .env
使用终端,则可以键入Ubuntu - 打开您的
.env
文件并将数据库名称 (DB_DATABASE
)更改为您拥有的任何名称,用户名 (DB_USERNAME
) 和密码 (DB_PASSWORD
) 字段对应于您的配置。
默认情况下,用户名是root
,您可以将密码字段留空。(这是针对 Xampp 的)
默认情况下,用户名是root
,密码也是root
。(这是灯用的) - 跑
php artisan key:generate
- 跑
php artisan migrate
- 跑
php artisan serve
- 转到本地主机:8000
回答by Nestor Rojas P.
Run the following commands:
运行以下命令:
git clone --single-branch --branch [TAG_VERSION] https://github.com/laravel/laravel.git [CUSTOM_PROJECT_NAME]
composer install