144

I want to clone a GitHub repository from Visual Studio, and the default path is C:\Users\[User]\Sources\Repos\[NameOfProject].

Snapshot

How do I change it? Every time I create or clone a repo, the path remains the same.

6 Answers 6

255

In Visual Studio 2015 / 2017 / 2019:

  1. Go to the menu bar, click View and then select Team Explorer
  2. Click the Home icon button in Team Explorer
  3. Click on Settings
  4. Click on Global Settings under Git
    (Note: may not appear if you have no cloned git repos)
  5. Alter the path for the Default location.
  6. Click OK/Update

Note: the location is case-sensitive, and it will not warn you if that exact location is not found

8
  • 3
    This should be the correct answer as the names in the instructions completely match those found in Visual Studio. Oct 3, 2018 at 15:30
  • 2
    For me it said Offline and offered no option because I hadn't cloned a repository yet. Even though I wanted to change a global repository setting, not a local one.
    – MrFox
    Jan 2, 2019 at 9:03
  • 3
    If you don't see the settings for Git, go into Tools -> Options -> Source Control -> Plug-in Selection, and set it to Git
    – John
    Nov 15, 2019 at 14:13
  • Is there a way to set it automatically for several users?
    – scls
    Dec 9, 2019 at 16:09
  • 6
    Visual Studio 2019 16.8.3: Tools > Options > Source Control > Git Global Settings > Default location Jan 9, 2021 at 1:57
44

In addition to the Team Explorer's Git settings...

enter image description here

...you'll likely want to change the default project location:

Tools | Options | Projects and Solutions | Locations

enter image description here

0
38

For VS2013 v4+ and VS2015

Click on "Settings" (from either the project Home menu or from the top dropdown menu), then select "Git Settings." You will see a Global Setting of "Default Repository Location" (the one you want). Change it and click Update.

3
  • That is for VS 2015, isn't it?
    – SuperJMN
    Jan 13, 2015 at 20:53
  • Just double checked, both 2013 with Update 4 and 2015
    – BikeMrown
    Jan 14, 2015 at 21:45
  • Confirmed - this works with Visual Studio 2017 15.9.
    – Bertie
    Feb 5, 2021 at 14:14
7

Easiest way to access this in 2019:

  1. Ctrl+Q to get to quick launch (or click on it at the top of the window)

  2. Type git settings enter image description here

  3. Change Default Location here enter image description here

7

I am able to access Git Global Settings from Visual Studio "Tools..." menu rather than from Team Explorer:

[VS2019] => Tools | Options... [Source Control] > Git Global Settings

(I have not tested it with earlier versions of Visual Studio.)

This works even when you have not opened and/or cloned a Git repos.

enter image description here

6
  • How is this different from accepted answer? Mar 24, 2021 at 4:57
  • The accepted answer requires a GIT repos to be open. Otherwise, there is no "Global Settings" button. This approach is always available.
    – Paul Yao
    Mar 25, 2021 at 15:34
  • I see....you can also (from the menu) just do Git->Settings. Mar 25, 2021 at 16:39
  • This answer should have received more votes as well b/c I've noted that Step 3 of the popularly accepted answer isn't always true even when there are cloned Git repos. This method seems to always work regardless of having cloned Git repos or not
    – Mark
    Apr 14, 2021 at 12:10
  • TeamExplorer isn't used in Git repos in later versions of VS2019. This option uses the Git Global Settings and worked. Apr 22, 2021 at 11:15
4

Visual Studio 2022 Git repo default location and project default location are not the same thing.

  • For default git repo location: Options -> Git Global Settings -> Default Location
  • For default project location: Options -> Projects and Solutions -> Locations -> Project location

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.