tags:

views:

35

answers:

2

I create .gitignore in folder with my repository near .git

project
--.git
--.gitignore
--Source
----tmp
----scr

But git doesnt see it, wouldnt ignore files in .gitignore

My .gitignore file:

*.tmp
*~
*.pdb
*.user
*.suo
Sources/tmp

What`s wrong?

Up: I created new repositiry, add .gitignore before init commit - it work! But if I add in old repository it doesn`t...

A: 

The problem is that you're specifying glob syntax when the default syntax for git is regex.

Try this instead:

.*\.tmp
.*~
.*\.pdb
.*\.user
.*\.suo
Sources\/tmp
OJ
No it doesn't. You are probably thinking of Mercurial.
Marcelo Cantos
Hrm, could have sworn it was Git :) Ah well!
OJ
No worries. BTW, the down-vote wasn't me.
Marcelo Cantos
Mate, if it deserves a downvote I have no problem with it :) That's what SO is about eh? :-D
OJ
A: 

What you have should work, though your directory listing has Source/ while your .gitignore has Sources/.

The one thing that springs to mind is that the line endings might not be what git is expecting.

Also, as tmp is a directory, usually a trailing '/' is used:

Source/tmp/

Finally, you can also create a .gitignore in Source/ with the line:

tmp/ instead of having it in the top directory.

wnoise
I did this, but nothing.
mystdeim
@mystdeim: I really do expect it to be a line-endings issue.
wnoise