laravel .gitignore 不适用于被忽略文件夹的子文件夹
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/29166030/
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
.gitignore does not work for subfolder of ignored folder
提问by Lemaru
I'm using Laravel and the Github program for subversions. In my .gitignore file i type:
我正在使用 Laravel 和 Github 程序进行颠覆。在我的 .gitignore 文件中,我输入:
/vendor
/vendor
My project structure looks like this:
我的项目结构如下所示:
Root
app
bootstrap
public
vendor
And it's all the files in vendor i want to ignore in git. Most of the files works to ignore there with typing /vendor in my .gitignore, but some files don't.
这是我想在 git 中忽略的供应商中的所有文件。大多数文件都可以通过在我的 .gitignore 中输入 /vendor 来忽略那里,但有些文件没有。
The files that doesn't work are autoload.php - vendor/autoload.php
不起作用的文件是 autoload.php - vendor/autoload.php
And files in vendor/composer
- like:
和文件vendor/composer
- 如:
autoload_classmap.php
autoload_namespaces.php
autoload_real.php
ClassLoader.php
installed.json
What am i doing wrong in my .gitignore file?
我在 .gitignore 文件中做错了什么?
回答by SMNTB
After adding vendor folder in gitignore did you clear the git cache
在 gitignore 中添加供应商文件夹后,您是否清除了 git 缓存
git rm -r --cached vendor
git add .
git commit -m ".gitignore"
This will remove vendor folder completely.
这将完全删除供应商文件夹。
回答by Oleg Shkliaiev
Okay. So I got the problem. I don't know how but my .gitignore
file pushes it self in a directory called .gitignore
I just deleted that directory and copied the content of the file in the root of the git project and updated it. Worked for me. Just consider this: file .gitignore
should be in the root directory of the repo.
好的。所以我遇到了问题。我不知道如何,但我的.gitignore
文件将它自己推送到一个名为.gitignore
我刚刚删除该目录的目录中,并将文件的内容复制到 git 项目的根目录中并对其进行了更新。对我来说有效。考虑一下:文件.gitignore
应该在回购的根目录中。