295

So I just updated to a new Visual Studio version and I am no longer able to push/pull from/to my Azure Repo (cloning works fine). The exact error I get is

Cannot determine the organization name for this 'dev.azure.com' remote url. ensure the credential.usehttppath configuration value is set, or set the organization name as the user in the remote url '{org}@dev.azure.com'.

and only the pull command shows me this error, all the others are failing with git fatal error. I messed with my Credentials Manager cos I suspected it might be the one causing the problem but no luck.

Vy Do
  • 46,709
  • 59
  • 215
  • 313
Menyus
  • 6,633
  • 4
  • 16
  • 36
  • 2
    Thanks for this, I hunted for any solution over the week end and came up with nothing. Do you know if this change in the credential manager (whatever that is) is associated with the most recent VS 2019 update which I took last week? I am now on version 16.9.1. – Peter Mar 15 '21 at 06:50
  • @Peter Yes i'm kinda certain in it cos i updated VS some day ago, and yesterday before pushing to my branch i decided to update to the latest one again hoping a strange warning message would dissapear :D. Well this little manoeuvre took me like 2 hours lol (I'm also on 16.9.1, found non in the issue tracker that might cause this issue tho) – Menyus Mar 15 '21 at 08:54
  • I had the same issue with VS Studio Profesional 2019 Version 16.9.1 (latest update for March 2021) – Carlos Bolivar Mar 15 '21 at 14:38
  • Same issue with VS Studio Community Edition 2019 Version 16.9.1 – Tich -- Lil3p Mar 16 '21 at 03:27
  • Same issue with Visual Studio Professional 2019 Version 16.9.1 – NickAndrews Mar 16 '21 at 13:09
  • 1
    Same issue with Visual Studio Professional 2019 Version 16.9.2 -- setting the Credential helper - GCM Core setting in Valentin Atanasov's answer fixed it for me. – Nathan W Mar 17 '21 at 16:03
  • 1
    And again when upgrading to VS 2022 when getting a new PC and installing the latest version of the software – Peter Jan 26 '22 at 23:19
  • 1
    Check your git version. [As stated by Microsoft:](https://learn.microsoft.com/en-us/visualstudio/version-control/git-settings?view=vs-2022#credential-helper) Unset (default): If this setting is unset, the credential helper set in the system config is used. As of Git for Windows 2.29, the default credential helper is GCM Core. – kaseidu Feb 21 '22 at 11:18
  • In case your getting this issue in **Sourcetree** you may find your **salvation** which saved me couple of hours in this [Atlassian Community post](https://community.atlassian.com/t5/Sourcetree-questions/Azure-DevOps-with-Sourcetree-Adding-a-remote-account/qaq-p/1065001#:~:text=You%20will%20try%2C%20and%20think%20you%20are%20not%20successful%2C%20but%20you%20are%20really%20near%20from%20it%20!%20follow%20with%20me%3A)!!! – Elias Sep 22 '22 at 14:57

11 Answers11

603

What fixed the issue for me is going to Tools > Options > Source Control > Git Global Settings, there I changed all 4 dropdowns which were still selected as "Unset":

  • Prune remote branches during fetch - False
  • Rebase local branch when pulling - False
  • Cryptographic network provider - OpenSSL
  • Credential helper - GCM Core

Source: https://learn.microsoft.com/en-us/visualstudio/ide/git-with-visual-studio?view=vs-2019#personalize-your-git-settings

Note: These are the settings my organization requires. You might have to tweak them around according to your exact issue.

Menyus
  • 6,633
  • 4
  • 16
  • 36
Valentin Atanasov
  • 6,062
  • 1
  • 4
  • 4
  • 65
    I guess that is the key *Credential helper - GCM Core*, which the update automatically sets – Menyus Mar 16 '21 at 13:55
  • 94
    I can confirm it is the Credential helper - I left everything else untouched and it resolved the issue. – Athanviel Mar 19 '21 at 08:32
  • 4
    It worked perfect for me, the error message started after the update to the version 16.9.1 – Florian SANTI Mar 19 '21 at 16:37
  • 10
    I actually used GCM Windows and it fixed also – tom redfern May 14 '21 at 10:30
  • https://stackoverflow.com/questions/66629862/cannot-determine-the-organization-name-for-this-dev-azure-com-remote-url/67916722#67916722 This solution worked for me better. –  Jun 18 '21 at 11:39
  • This solution is amazing. This works like a charm. It resolved my ages long Git issues I think. Thank you @Valentin Atansov – Apoorv Jul 13 '21 at 06:30
  • 6
    Just here to echo what others said in regards to it being the Credential Helper that was the issue here. Except mine was already set to GCM Core (not Unset). Changing it to GCM for Windows resolved the problem – Josh Wright Sep 27 '21 at 10:13
  • Also had to restart visual studio, after choosing these settings, to fix it – David Pierson Oct 19 '21 at 04:43
  • 2
    Setting the Credential helper to **GCM for Windows** solved the problem for me – Marcel Wolterbeek Oct 19 '21 at 09:23
  • CGM Core worked fine for me. Thanks! But I don't get it. This happened when starting using VS 2022. It worked fine in VS 2019. Maybe this was described somewhere in installation doc, but *why* do we have to spend hours finding stuff like this? There was another thing too: The push worked find in the first place, although the "fatal error". Extremley confusing and a really bad user experience. – user736570 Nov 16 '21 at 13:29
  • GCM Core worked for VS 2022 for me, but broke VsCode - In case anyone encounters the same issue, GCM for Windows works for both – Carter Musick Nov 22 '21 at 20:20
  • Changing only Credential helper from Unset to GCM for Windows fixed the issue for me immediately! – Chandraprakash Jan 19 '22 at 20:28
  • It's definitely credential helper which is necessary here - thank you! – GeorgePotter Jan 24 '22 at 12:26
  • Agree with @tom redfern, setting to **GMC for Windows** solved my problem – Kaine Feb 10 '22 at 16:16
  • Thanks a lot, i was scratching my head with this error, though i was able to see my changes in the Azure Devops repo...but followed your steps and now that error is gone. – Ron Feb 03 '23 at 16:50
72

Okay, I just updated git for windows git update-git-for-windows with git bash. Then selected the new non deprecated credential manager when installing and now it works fine.

participant
  • 2,923
  • 2
  • 23
  • 40
Menyus
  • 6,633
  • 4
  • 16
  • 36
  • Hi, Thanks for the sharing, you could [Accept it as an Answer](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work/5235#5235) , it could help other community members who get the same issues and we could archive this thread. Thanks. Have a nice day. :) – Vito Liu Mar 17 '21 at 01:50
  • I am using commandline but could you provide more details about this fix? `git-for-windows` is up-to-date, how do I find out the deprecated credential manager, and how to switch to the fixed one? Thanks. – Marc Vitalis Mar 17 '21 at 04:01
  • 1
    @MarcVitalis I uninstalled and installed it back. Then there's an option to choose the new credential manager. – jambis Mar 19 '21 at 11:10
  • I was getting error but remote branch reflected all of my changes too, updating git with new credential manager resolved it. – abdul qayyum Mar 29 '21 at 12:34
  • Apparently, when you update git (mine through scoop) it reverts back the `gcm-core to older versions. Just go to the releases website, and install the latest update and it should work fine. – Marc Vitalis Apr 12 '21 at 03:57
59

IDE-agnostic solution that worked for me:

  1. Open Command Prompt
  2. Run git config --global credential.useHttpPath true (the --global parameter is optional)

Git-Credential-Manager-for-Windows docs useHttpPath

AlvinH
  • 969
  • 3
  • 12
  • 10
  • 2
    This fixed the issue for me. The other changes (upgrading git and changing values in Tools > Options > Source Control > Git Global Settings did not fix the problem until I executed the ```git config``` command shown in this answer. – mherzog Dec 22 '21 at 13:35
  • Thanks. This was the solution for me as well. Probably works since I have git installed "outside" Visual Studio – HenningK Jun 01 '22 at 13:44
  • 4
    The setting can be specific to Azure Repos `git config --global credential.https://dev.azure.com.useHttpPath true` [Source](https://github.com/GitCredentialManager/git-credential-manager/blob/main/docs/wsl.md#configuring-wsl-with-git-for-windows-recommended) – Saftever Nov 08 '22 at 10:56
  • Worked for me as well, everything was fine (in the Java world) until I made the mistake of playing with VS Code, it recommended (wrongly) that I update GIT, I did so and it broke Git :-/ – JGlass Apr 13 '23 at 23:36
  • 1
    this needs to be upvoted to the top – Dhruv May 11 '23 at 20:36
31

Check your credentials in Tools > Options > Source Control > Git Global Settings enter image description here

15

I encountered this error and I was able to resolve it by installing the latest version of gcm-core.

https://github.com/microsoft/Git-Credential-Manager-Core/releases

Marc Vitalis
  • 2,129
  • 4
  • 24
  • 36
  • I had Git installed by `scoop`. Even though it has the latest version of GCM Core bundled, that version doesn't work properly. A separate install of GCM Core solved the problem. – Monsignor Nov 08 '21 at 13:14
11

Under Tools> Options > Source Control > Credential Helper Select GMC for windows

VS have always being a pain with accounts

Rene Sosa
  • 111
  • 1
  • 2
5

In Visual Studio Code you don't have the option of Tools > Options > Source Control > Git Global Settings

Open a GIT bash (installed with Git Credential Manager for Windows enabled), and run

git config credential.useHttpPath true
Victor AQ
  • 51
  • 1
  • 2
  • Thanks. It worked. Had the same issue with Tower. Had to switch to Git for windows binary, installed with GCM enabled, then open git terminal from Tower, and then run the above command and then run git fetch to test in the same terminal. – Paul-Sebastian Manole Jun 27 '23 at 14:15
4

Ok, so I encountered this problem today when I updated VS2019 to 16.9.6 (from 16.8.x). I tried the recommended answer and that failed - very strangely, actually, VS refused to persist my changes to the GIT global settings (let me change them in the dialog, but fetch/push still failed, and when I looked at the settings again, they were back to "unset"). I tried another answer above, updating gcm-core, but still made no difference. In the end I removed git entirely, then reinstalled the latest version (2.31.1) - and suddenly it worked.

Since I was so frustrated by this experience, I thought I'd post what finally worked for me, in case it helps someone else.

1

I use SourceTree and the above responses didn't help on their own, until I clicked SourceTree -> Tools -> Options -> Git -> Git Version -> System. This switches SourceTree from using the embedded Git to using system Git. This can introduce other issues of compatibility, but fixed the problem in question for me and works fine for now.

evilkos
  • 545
  • 10
  • 17
1

I had the same issue when using the source tree on windows laptop.

Sometimes multiple Git versions running on the same machine could create issues.

Simply open Source Tree Select Tools->Options->Git

Scroll down and under "Git Version" select System.

it will solve the issue.

Mirza Q Ali
  • 477
  • 5
  • 6
0

Hi I use SourceTree and have same error message, I resolved it by changing:

Open Settings / Remotes, and click edit button. Change:

https://[your-company-name].visualstudio.com/[path-to-repo]

to

https://[your-company-name]@dev.azure.com/[path-to-repo]

Lê Văn Hiếu
  • 171
  • 1
  • 6