7

I am working on a small git project involving .obj files.

When I look at the "project tab" I see they are ignored

enter image description here

But I cant understand why, if I look at my .gitignore:

/DepthPeeling/nbproject/private/
/DepthPeeling/dist/
/DepthPeeling/build/

It looks fine

If I open a Git Bash and type

$ git add dragon.obj
The following paths are ignored by one of your .gitignore files:
DepthPelling/sry/depthPeeling/data/dragon.ogj
Use -f if you really want to add them.
fatal: no file added

Wut?

Might it be there is more than one .gitignore file? If I look for them, I find only the one in the root directory of the project itself (the one I shown before) and nothing more..

Edit: so it looks like I have a global ignore D:\Documents\gitignore_global.txt

#ignore thumbnails created by windows
Thumbs.db
#Ignore files build by Visual Studio
*.obj
*.exe
*.pdb
*.user
*.aps
*.pch
*.vspscc
*_i.c
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
*.dll
*.lib
*.sbr
3
  • Yes, there can be a .gitignore in each directory, and ignored files can be specified in other ways. Try find <repo> -name .gitignore and cat <repo>/info/exclude.
    – Biffen
    Commented Mar 20, 2015 at 7:32
  • Can you do a search for other .gitignore files in your project? From your screen capture, it looks like you are running Windows. Commented Mar 20, 2015 at 7:32
  • @TimBiegeleisen I just used the window explorer
    – elect
    Commented Mar 20, 2015 at 7:37

1 Answer 1

15

You can easily find which .gitignore (and which rule) is responsible for ignoring your .obj file using git check-ignore:

git check-ignore -v -- dragon.obj

The OP reports:

"D:\\Documents\\gitignore_global.txt":5:*.obj –

That is similar to this comment:

it was the installation of SourceTree (a tool visualize git repo) which un-logically created under documents folder a gitignore_global.txt which included plenty of exclusions.

A git config -l should show something similar to:

[core] 
   excludesfile = C:\\Users\\username\\Documents\\gitignore_global.txt
3
  • 1
    Oh god, you were right, "D:\\Documents\\gitignore_global.txt":5:*.obj
    – elect
    Commented Mar 20, 2015 at 7:37
  • @elect Looks like a source tree installation: stackoverflow.com/questions/9436405/…. I have edited the answer.
    – VonC
    Commented Mar 20, 2015 at 7:40
  • Anyway the commit see them now and I am uploading them right now, thanks!
    – elect
    Commented Mar 20, 2015 at 7:42

Not the answer you're looking for? Browse other questions tagged or ask your own question.