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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 01:39:04  来源:igfitidea点击:

cloning laravel project from github

phplaravelgithubcomposer-php

提问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 tortoisegitto 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 .gitignorefile and push them from a working project. Then it will work perfectly where you git clonethem.

您可以删除.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 cdcommand on your cmd or terminal
  • Run composer installon your cmd or terminal
  • Copy .env.examplefile to .envon the root folder. You can type copy .env.example .envif using command prompt Windows or cp .env.example .envif using terminal, Ubuntu
  • Open your .envfile 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 is rootand you can leave the password field empty. (This is for Xampp)
    By default, the username is rootand password is also root. (This is for Lamp)
  • Run php artisan key:generate
  • Run php artisan migrate
  • Run php artisan serve
  • Go to localhost:8000
  • 克隆你的项目
  • 使用cdcmd 或终端上的命令转到文件夹应用程序
  • 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