I'm running VS 2013 Update 3 with the 'Visual Studio Tools for Git' extension. This extension is for users of both team explorer and Git and I have no other Git and TFS related extensions installed and running. I use Microsoft's TFS Cloud service to backup and share my work.
Everything worked as expected for a few months. I want to be able to use this VS extension again, but the problem is that the files that should be ignored by .gitignore are being included by default. The same Git repository when viewed from the command line does not have this problem and works as expected.
Possibly important: I have at one time half-way set up a straight TFS account online but never used it locally and that never correlated with any problems I have mentioned here. Also, a long time ago I had to follow the advice in another posting to remove these binary files from version control because I added the .gitignore file too late. Since the command line doesn't have this problem I think something else is at work and that --hard reset actually worked as intended.
What is the problem with VS? Is there some way to change a setting or generally correct the oversight to ignore the files in the .gitignore file in the Git directory but not ignore the .gitignore file?
To head off some potential questions: I confirmed that the directories, and branches are the same on both interfaces by observing that all changes are added to Git/TFS and Posh Git as well as Git Bash and all other Git interfaces I have tried. The only problem is that additional files that should be ignored are not ignored in the VS extension.
Here is a sample of the .gitignore file that I use, which was produced by VS:
## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. # User-specific files *.suo *.user *.sln.docstates # Build results [Dd]ebug/ [Rr]elease/ x64/ build/ [Bb]in/ [Oo]bj/
Some times, even if you haven't added some files to the repository, git seems to monitor them even after you add them to the . gitignore file. This is a caching issue that can occur and to fix it, you need to clear your cache.
The . gitignore file's purpose is to prevent everyone who collaborates on a project from accidentally commiting some common files in a project, such as generated cache files. Therefore you should not ignore .
If you already git add ed some files, their changes will still be tracked. To remove those files from your repository (but not from your file system) use git rm --cached on them. git rm --cached file_name. ext wroks fine for me to update gitignore for one file.
Open Visual Studio and the solution needing an ignore file. From the top menu select Git > Settings. The above will open Visual Studio's Options with Source Control > Git Global Settings selected. From the list on the left select Git Repository Settings and then click the Add button for Ignore file.
We recently had the the same problem with the VS2013 git provider ignoring the .gitignore
for only a few files. It turned out, there was ms-persist.xml
in the .git
folder with the two relevant sections <TrackedFiles>
and <IgnoredFiles>
.
As suggest in a blog post by Eric Nelson closing VS, deleting the file and restarting VS again solved the problem.
You say that you are using VS 2013? If so, you do not need the extra git tools. I don't have them installed on my VS 2013, can use TFS with GIT just fine, and I don't experience the issue with .gitignore being ignored.
You can even manage the .gitignore via the IDE GUI so formatting should always be in the format desired by TFS/VS: http://msdn.microsoft.com/en-us/library/vstudio/hh967655.aspx#ignore
As stated in the Requirements from: https://visualstudiogallery.msdn.microsoft.com/abafc7d6-dcaa-40f4-8a5e-d6724bdb980c:
Note: Visual Studio 2013 includes Git tools by default so these tools are not needed. Learn more on MSDN: http://msdn.microsoft.com/en-us/library/vstudio/hh850437.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With