Authentication failed for Azure Git

I had the same problem with my site and it turned out the issue is with the site url: the automatically generated remote url was: https://[email protected]/site.git

On the other hand the portal showed: https://[email protected]:443/site.git

After updating the remote url in git with the following command:

git remote set-url azure
https://<user>@<site>.scm.azurewebsites.net/<site>.git
https://<user>@<site>.scm.azurewebsites.net:443/<site>.git

things started working as expected.

The morale of the story: check the deployment url as well as the password.


Yes many of the answers here are pointing to the correct path, but my case:- I was given a url to access git repos on azure cloud for which I'm perfectly fine to access/browse the code on browser (Vs) when I'm trying to clone I've got the same issue.

So when you click on clone as shown in below image, you've got to Generate Git credentials; this is weird, not sure why, probably they've setup my account to access azure cloud, which can't be used to clone git repos(means can't be used as git credentials). This is something different from what I've seen with AWS/gitlab/bitbucket, maybe an issue with account setup, or if it's common thing for repos on Azure and if you're in same issue - give it a try. enter image description here

Another one, as everyone has already mentioned, please don't try to connect to url which is produced over there (something looks like):

https://[email protected]/project-name/apps/_git/library/

Instead try to connect thru your GIT username and then use password:

https://[email protected]/project-name/apps/_git/library/

As a tip: if your username has special characters in it, Git cmd/bash will throw errors, so replace those with valid characters, ex. :-

  1. @ can be replaced with %40
  2. + can be replaced with %2B

something like : https://username%[email protected]/project-name/apps/_git/library/


Accepted answer did not work for me but this worked.

  1. Check your set Azure URL with

    git config --get remote.<azure-remote-name>.url
    
  2. Reset azure url with following command

    git remote set-url <azure-remote-name>
    https://<user>@<sitename>[_<slotName>].scm.azurewebsites.net:443/<site>.git
    
  3. Try pushing your code using

    git push <azure-remote-name>
    
  4. It will open windows authentication screen which says to enter credential to connect to https://<user>@<sitename>[_<slotName>].scm.azurewebsites.net/<site>.git

  5. Cancel this window. It will prompt the basic credential window which says to enter credential to connect to https://<user>@<sitename>[_<slotName>].scm.azurewebsites.net:433/<site>.git

Enter in your credential and it works.