1

.gitignore contains the only line *.out However, on some PC git status shows files with .out extensions

How to fix this ?

Update - the .out files are not tracked !

  • 2
    The most likely explanation is that your repository already contains the particular file being shown in `git status`'s output. Is that the case? If so, it's working as designed, and there are other questions that already have good answers explaining why it works like that. I'll see if I can find one. –  Feb 12 '15 at 16:33
  • 1
    possible duplicate of [Ignore files that have already been committed to a Git repository](http://stackoverflow.com/questions/1139762/ignore-files-that-have-already-been-committed-to-a-git-repository) –  Feb 12 '15 at 16:34
  • Actually, *.out are not tracked. I they were, I'd solved the problem some hours ago –  Feb 12 '15 at 16:53
  • ' on some PC' -> so what is different on that pc? what does git version show? have you double checked .gitignore on that pc including checking for file perms, invisible chars etc? – tolanj Feb 12 '15 at 16:55
  • `.out` is visible under git version `1.9.5.msysgit.0` and invisible under `1.9.4.msysgit.0` –  Feb 12 '15 at 17:06
  • 1
    Perhaps you have different commits checked out in the two locations, and the contents of `.gitignore` is different in one of them? Or maybe a `.gitignore` in a subdirectory overrides the one in the root of the working directory? Posting actual output might help sort that out... – twalberg Feb 12 '15 at 17:23
  • Please show the output of `git status` and `cat .gitignore`. – poke Dec 27 '15 at 15:25

3 Answers3

1

The gitignore file ignores only files which aren't already added to the repo so non tracked files. You have to remove them first with:

git rm --cached filename

Otherwise the files are modified when you edit them.

René Höhle
  • 26,716
  • 22
  • 73
  • 82
0

.gitignore works only for non tracked files so other users should remove them from index.

Gaskoin
  • 2,469
  • 13
  • 22
0

gitignore rules must be alone on their line in order to work. That is:

*.out  # My output logs

will not work; while:

# My output logs
*.out

will work. I'm guessing that this is because gitignore looks for comments as lines that start with #

Rick
  • 563
  • 3
  • 6
  • 24