So awhile ago I noticed that Visual Studio was automatically creating a .gitignore file whenever I created a solution inside an existing local git repo folder. Great. However, I noticed it was ignoring some NCrunch files (*.ncrunchsolution and *.ncrunchproject) that should really be in source control. So I decided to dig in to fix it. The problem here is I don't know where it's getting this default file from. I see that it's basically an older version of VisualStudio.gitignore at the gitignore GitHub project (which just so happened to fix the NCrunch issue back in April).
Where can I find or configure the source for the .gitignore that the Visual Studio git provider automatically puts into a git repo?
(Edit: I looked at the ignore topic what I assume are the official docs for the VS 2013 git functionality, but it doesn't help to find a system-wide setting for this. It simply mentions "the default .gitignore file provided by Visual Studio" without any mention of how to modify this file.)
gitignore file is a plain text file where each line contains a pattern for files/directories to ignore. Generally, this is placed in the root folder of the repository, and that's what I recommend. However, you can put it in any folder in the repository and you can also have multiple .
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.
Press CTRL + Shift + P ( CMD + Shift + P on macOS) to open the command palette. Type in Add gitignore in the command palette. You'll be presented with a language to generate the gitignore file for. And there you go!
1. Using IDE. Some IDE generates the GitIgnore file automatically when creating a new project. As far as I know, all of IntelliJ IDE (Android Studio, RubyMine, PyCharm, etc) already automatically generate the GitIgnore file.
The default .GitIgnore
is an Embedded Resource of
// Assembly Microsoft.TeamFoundation.Git.CoreServices, Version 12.0.0.0
Location: C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Microsoft.TeamFoundation.Git.CoreServices.dll
Name: Microsoft.TeamFoundation.Git.CoreServices, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
Type: Library
// public resource Microsoft.TeamFoundation.Git.CoreServices.Resources.VS.gitignore
So I don't think you can update it.
It was recently updated with Visual Studio 2013u2, but it seems the ncrunch
files are still part of the default ignores. I suspect that a newer version will be included in 2013u3 or maybe as an interim update. Until then, you'll need to manually patch your gitignore
files or create a default gitignore in your userprofile.
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