Reputation: 17498
I've seen many posts on SO about this but none of the solutions I've tried work.
I have a directory structure as follows
MySite\Bin
MySite\Obj
MySite\Important
My .gitignore file which is at the root is (and yes I've tried removing the * also)
MySite\bin\*
MySite\obj\*
Executing the command git status shows this
# modified: .gitignore
# modified: SomeOtherFile.fle
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# MySite/bin/
# MySite/obj/
I've tried executing the following commands
git rm -r MySite\bin
git rm -r --cached MySite\bin
git rm MySite\bin\fileToIgnore.dll
git rm --cached MySite\bin\fileToIgnore.dll
And I keep getting this error fatal: pathspec 'MySite/bin' did not match any files
When executing git add . the files in MySite\Bin and MySite\obj are added to the staging items. Why?
I'm also using the windows version of git (mysysgit).
Many thanks!
Upvotes: 2
Views: 306
Reputation: 40159
You have your slashes in the wrong order.
MySite/bin
MySite/obj
According to the docs of gitignore it is a pattern. And Git path pattern always follows unix path names with forward slashes.
Do that and it should work.
Upvotes: 3
Reputation: 13628
Not to point out the obvious, but you have Bin and bin. (Note case). I believe git is case sensitive no matter the platform.
Upvotes: 2