.gitignore不忽略目录

时间:2020-10-01 17:06:57

标签: gitlab

我在我的项目中使用目录结构

my-module/src/main/resources/<my-dir-to-be-ignore> 

我将.gitignore文件添加为my-module / .gitignore,这是.gitignore文件的内容。

**/src/main/resources/<my-dir-to-be-ignore>/

这无效,并尝试使用以下步骤

https://digitizor.com/gitignore-not-ignoring-files-how-to-fix/

但是当我尝试运行命令“ git rm -r --cached .”时,我遇到了错误消息

fatal: pathspec '.' did not match any files

1 个答案:

答案 0 :(得分:0)

为了进行测试,请尝试直接在资源中添加.gitignore,内容如下:

myDirectoryToIgnore/

然后,仍然在该文件夹中,检查它是否可以使用:

git check-ignore -v -- myDirectoryToIgnore/aFile