0
我无法让.gitignore忽略一个目录...我已经读过其他线程,他们都建议没有被忽略的目录或文件已被提交,这就是为什么它不是忽略。不是这种情况。你能否看看我在做什么,并让我知道我在做什么错了?.gitignore不会忽略指定的目录
如果我没有正确格式化,我很抱歉...我是新来的stackoverflow。
$ mkdir stackoverflow_example
$ cd stackoverflow_example
$ git init
$ mkdir ignoreThis
$ echo "/ignoreThis" > .gitIgnore
$ cd ignoreThis
$ echo "ignore this text file in the ignoreThis directory" > ignoreText.txt
$ cd ..
$ type .gitignore /ignoreThis
$ git status
On branch master
Initial commit
Untracked files: (use "git add ..." to include in what will be committed)
.gitIgnore
ignoreThis/
nothing added to commit but untracked files present (use "git add" to track)
不应该ignoreThis
不应该在我的临时区域列出此时。
你试过了吗? – androidevil 2015-04-03 13:10:16
感谢您的回复以及正确格式化我的问题。 我刚刚删除了该文件并创建了一个名为.gitignore的文件,具有相同的结果。 也许我应该提到我在Windows 7上,它可以在我的Mac上工作? – Dugan 2015-04-03 20:45:56
我在Linux中完成了相同的步骤,并且工作正常。我没有在Windows上试过。我不知道你为什么在Windows中遇到这个问题。按照这个问题,你正在做正确的方式 - http://stackoverflow.com/questions/343646/ignoring-directories-in-git-repos-on-windows – androidevil 2015-04-04 01:37:44