My .gitignore
file seems to be being ignored by git - could the .gitignore
file be corrupt? Which file format, locale or culture does git expect?
My .gitignore
:
#this is a comment
debug.log
nbproject/
Output from git status
:
# On branch master
# Your branch is ahead of 'origin/master' by 1 commit.
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# debug.log
# nbproject/
nothing added to commit but untracked files present (use "git add" to track)
I would like debug.log
and nbproject/
not to appear in the untracked files list.
Where should I start looking to fix this?
Ok, so in my case the accepted solution did not work, and what worked is described here:
https://ericnelson.wordpress.com/2014/06/21/is-visual-studio-2013-ignoring-your-gitignore-file/
In short:
Hope this helps somebody sometime
In my case, it's because the files already exist in the repo and I'm trying to ignore it.
These are the things I did to fix the issue:
By then, any changes I made on those files were ignored.
I think you can't ignore files that already exist on the repo.
Another cause of this issue is blank spaces or tabs before the statement:
Example:
And as pointed out by the comment bellow a trailing space can be an issue aswell
Also check out the directory, where you put .gitignore It should be in root of your project:
not in
In my case, the .gitignore wasn't working because I added a comment on the line containing the file to ignore:
Placing the comment on a separate line thus fixed it:
As with the other solutions, commit first and be aware that you WILL lose any un-committed changes.
I had better results with this:
note that the status should have no modified files now.