使用版本控制时,在 Laravel 4 项目中要忽略哪些文件/目录?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17003253/
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
Which files/directories to ignore in a Laravel 4 project when using version control?
提问by Rubens Mariuzzo
I have a Laravel4 project, and I would like to know which files should be ignored when using a version control software such as Git, Mercury or SVN?
我有一个Laravel4 项目,我想知道在使用 Git、Mercury 或 SVN 等版本控制软件时应该忽略哪些文件?
The structure of my project looks like the following screen capture.
我的项目结构类似于以下屏幕截图。
I'm pretty new to Composerso I'm not very clear about what goes to a repo what not. If someone can post their .gitignore
file or their SVN ignore property, it could be handy.
我对Composer还很陌生,所以我不太清楚什么会进入 repo,什么不会。如果有人可以发布他们的.gitignore
文件或他们的 SVN 忽略属性,那可能会很方便。
采纳答案by fideloper
For reference, that .gitignore
file can be found here:
作为参考,.gitignore
可以在此处找到该文件:
/bootstrap/compiled.php
/vendor
composer.phar
composer.lock # Remove this one after you create a project
.env.*.php
.env.php
.DS_Store
Thumbs.db
As noted in the below comment, you probably want to commit composer.lock
in your project. Laravel ignores it by default so the authors of the laravel/laravel
package don't accidently impose packages on you.
如以下评论中所述,您可能希望composer.lock
在您的项目中提交。Laravel 默认会忽略它,因此laravel/laravel
包的作者不会意外地将包强加给您。
Your project should include the composer.lock
file so you can install packages of stable versions (via composer install
instead of composer update
) properly in your production environments.
您的项目应包含该composer.lock
文件,以便您可以在生产环境中正确安装稳定版本的软件包(通过composer install
而不是composer update
)。
回答by Kzqai
Note that the config file:
注意配置文件:
app/config/app.php
Has a cryptographic key in it that wouldn't be great to commit to a repository. Or, at least, the file needs to be overwritten in production.
其中有一个加密密钥,不太适合提交到存储库。或者,至少,该文件需要在生产中被覆盖。
回答by SnapShot
You might also want to see the Laravel docs hereand here. This discusses how to setup different Laravel configurations for different environments and protect sensitive information. All your .env.local.php
type files should not be included in version control. Note that the .env.*.php
and .env.php
is added in the default Laravel .gitignore file. You can see it here
您可能还想在此处和此处查看 Laravel 文档。这讨论了如何为不同的环境设置不同的 Laravel 配置并保护敏感信息。.env.local.php
不应将所有类型文件都包含在版本控制中。请注意,.env.*.php
和.env.php
被添加到默认的 Laravel .gitignore 文件中。你可以在这里看到
回答by Niklas
回答by Jivesh
GitHub has a repository of suggested .gitignore files for almost all kinds of projects at: http://github.com/github/gitignore
GitHub 有一个几乎所有类型的项目的建议 .gitignore 文件的存储库:http: //github.com/github/gitignore
Alternatively, you can search it for your project using this handy and extremely useful online tool: http://www.gitignore.io
或者,您可以使用这个方便且非常有用的在线工具搜索您的项目:http: //www.gitignore.io