Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
gitignore无法按预期工作_Git - Fatal编程技术网

gitignore无法按预期工作

gitignore无法按预期工作,git,Git,似乎.gitignore不起作用,一些与文件中定义的模式匹配的文件仍然添加到git中 我在谷歌上搜索过,有人说git中存在的文件不能忽略 因此,在我的工作目录中,我创建了.gitignore文件,其中包含以下内容: */out/* 然后我就跑 git init git add -A 但是当我运行git status时,它告诉我文件“out/xxxx.xxx”已添加并要提交 有什么问题吗 似乎git init和git add命令并不关心.gitignore文件,不是吗?使用out/*而不是*/

似乎
.gitignore
不起作用,一些与文件中定义的模式匹配的文件仍然添加到git中

我在谷歌上搜索过,有人说git中存在的文件不能忽略

因此,在我的工作目录中,我创建了
.gitignore
文件,其中包含以下内容:

*/out/*
然后我就跑

git init
git add -A
但是当我运行
git status
时,它告诉我文件“out/xxxx.xxx”已添加并要提交

有什么问题吗


似乎
git init
git add
命令并不关心
.gitignore
文件,不是吗?

使用
out/*
而不是
*/out/*


*/out/*
将忽略路径为
foo/out/bar

的文件似乎我们有不同的顺序,我的“create.gitignore file-->init the repo”,他的“init the repo-->add the.gitignore file”更好,使用
***
,这意味着忽略
out
目录下的任何内容,无论该目录在哪里()。但这只适用于某些版本的Git(我不记得它是什么时候推出的),所以如果它不起作用,您就必须指定每个
out
子目录,比如
out/*
*/out/*