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.
Comment line as the first line of the file is critical! I spent considerable time trying to exclude files only to find that GIT was ignoring the first line in the ignore file.
I've had issues with .gitignore also. I checked out the linked answers listed about, which fixed half the issue.
What really got gitignore working full for me was adding a comment on the first line of the file. Git wasn't parsing the exclude situated on the first line.
Cheers
Are your files already tracked? .gitignore only silences comments about untracked files, but won't stop a tracked file from being tracked.
Try "
git add .
" instead.Also, it works for me (on Linux):
Probably your exclude file mask is inacurate.
You could have created a UTF-8 encoded text file. Try saving it as ANSI encoded. In git bash, you can verify by using vi -b.