I'm trying to create a new git repository from existing folder. I've created a .gitignore
file in the root of the folder. But if I say
git add *
git commit
git push
files that should be ignored still get committed to the remote repository. I'm on Windows.
Also I've bought a license for SmartGIT. It also seems to ignore .gitignore
. I have to manually select which new files to commit.
Your file must still be tracked, you can see by doing
git status
that will show you that your file is modified even if it's in .gitignoreYou need to do this:
I'm using git version 1.7.12.3 on MacOSX and the first line of .gitignore is also not taken into account. Just add a comment as first line.
A trick I faced on windows is that using
echo
(as per Jakub Narębski answer) you have to be careful with spaces.As you can see below any space before the redirection operator does have an effect on the actual ignore.