Reputation: 567
I'm using Github for Windows as a GUI to manage my Git repository for a Visual Studio C#/MVC project. (The master is hosted on bitbucket.org because it needs to be private for now, but that isnt the source of the problem.)
For the first dozen pushes or so I was pushing the bin, obj, and Debug stuff to the master. However, as other people started to have stuff to push, that naturally caused problems...
So, I went through my repository in Windows Explorer ande deleted all these temporary files/directories, and commited/pushed the changes to the master. I then deleted my repository on my machine and pulled down a fresh copy. No unwanted stuff, happy snappy.
Next I downloaded VisualStudio.gitignore from Github's recommended ignores and placed it at the root of my repository. (Hoping that this will persist it throughout the project?)
However, when I fire up Github for Windows and commit my local changes it's still finding all the /bin, /obj, etc. So, I opened up a shell and did a 'git diff' the only different file found is "ProjectOrganics.v11.suo" (Which I believe isn't specifically ignored in the .gitignore file...
I'm wondering if there's a tooling problem with Github for Windows that it doesn't take .gitignores into account? Or perhaps the master is still tracking these directories in spite of the fact that they were deleted in the latest commit to the master?? (And I deleted and rebuilt my entire repository on machine from the master.)
I also tried using 'git rm --cached' to manually remove the directories, however it wasn't finding them. I haven't been able to figure out what the git equivalent of 'dir' is, so I'm not sure if I was using an invalid filepath, or actually not there...
Edit1 - Directory "projectname" is just a stand-in for the name of my project. The first folder is the root of the directory.
./projectname/ (repository root)
.git/
VisualStudio.gitignore (the .gitignore)
ProjectName/ (Solution)
ProjectName.Doman/ (class library)
ProjectName.Web/ (mvc project)
ProjectName.sln
ProjectName.suo
...etc
What I want it to do is ignore the bin / obj folders in the .Domain and .Web folders. VisualStudio.gitignore is an exact copy past from github's site.
Upvotes: 3
Views: 3142
Reputation: 567
Alright, the problem was in the filename. I'd downloaded VisualStudio.gitignore
from a github and pasted the file into my directory assuming that it would work.
However, the proper name should just be .gitignore
- just a file extension, no name. Unfortunately Windows Explorer flips out if you try and do this, so you'll have to either create it through the command prompt, or through Github for Windows itself.
In the Github for Windows gui, right click on a file you want to ignore and choose "Ignore File". This will create the .gitignore
file. From there you can copy/paste in the contents of VisualStudio.gitignore
or whatever rules you want to use.
Upvotes: 5