gitignore 不忽略 windows vb.net 上的文件

gitignore not ignoring files on windows vb.net

我创建了一个文件夹,添加了一些代码,创建了一个 .gitignore txt 文件,其中包含以下内容:

*.cache
*.dll

然后我 运行 这些命令:

git init
git remote add origin htttps://...
git add .
git commit -m "first commit"
git status

而且我不断看到 .dll 和 .cache 文件...为什么 .gitignore 不起作用?

我也试过了:

git rm -r --cached .
git add .

但是dll和缓存文件还在添加中。

我的.gitignore在根目录下(我运行git init

如果 .gitignore 文件还不为您的 git 存储库所知(当您还没有提交文件时发生),那么 .gitignore 文件还没有积极的。尝试先提交文件(git add .gitignore,然后 git commit),然后再尝试添加其他文件。

参见:https://help.github.com/articles/ignoring-files/ and https://git-scm.com/docs/gitignore