Which .gitconfig file does Visual Studio use?

12,631

Solution 1

VS2017 has no Visual Studio specific .gitconfig.

You can alter the standard global git config file, or the local one for the repository in question.

To edit the global one:

git config --global --edit

To edit the repository local one

git config --edit

Solution 2

In case anyone else stumbles upon this issue, VS2017 and VS2019 does indeed use it's own instance of Git with it's own .gitconfig, at least if you're on the TFS platform.

These files are usually located here:

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\etc

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\etc

If you want to check which path is searched when VS is looking for Git, go to:

Tools -> Options -> Projects and Solutions -> Web Package Management -> External Web Tools

It's useful to know if you want to change which Git installation is being used.

Solution 3

The accepted answer is correct, however, more detail could be useful: VS 2017-2019 do not have a .gitconfig file, which is the global per user file. There IS however a lower precedence system-level gitconfig file (without the .) that's specific to the git installation. Since VS 2017-2019 have their own Git installation, you will find this within the VS folder hierarchy. If this file has configurations defined that don't match the default and are not redefined in higher precedence files, you can get unexpected results.

On the bright side, this is unlikely as VS Team Explorer settings don't expose this file and changing it via git config requires administrative access

Share:
12,631
user2023370
Author by

user2023370

Updated on June 04, 2022

Comments

  • user2023370
    user2023370 almost 2 years

    In Visual Studio Enterprise 2017 15.2 (26430.15) Release, when I push a simple test edit of my cloned public Github repository, it fails; with an error message concerning an AggregateException, and an inability to spawn "askpass". Other SO posts relating to that issue don't work for me.

    I'd like to try adding our http/https proxy settings manually to the .gitconfig file used by VS2017, but I can't find it. I have one already under cygwin, but I'm not sure if using that is a good idea - nor how to ask VS2017 to use it. (I also have Git Bash etc. already installed.)