Arn Vanhoutte
Arn Vanhoutte

Reputation: 1917

Authentication failed for Azure Git

I'm trying to clone my webapp in Azure.

When I run git clone https://[email protected]:443/appname.git the terminal asks me for my password.

But when I fill in my password, it keeps saying that the authentication has failed.

Even though I changed my password plenty of times in the Portal (Settings -> Set deployment credentials).

Any reason it keeps saying that my authentication has failed?

Upvotes: 74

Views: 199515

Answers (30)

anjanesh
anjanesh

Reputation: 4251

I'm using local Git deploy.

I disconnected and re-connected and it worked.

enter image description here

Upvotes: 0

Wachburn
Wachburn

Reputation: 2939

In my case I had to enable SCM Basic Auth Publishing Credentials on Configuration tab

Upvotes: 0

Ashkan Kiani
Ashkan Kiani

Reputation: 41

Go to Control Panel\All Control Panel Items\Credential Manager and click Add a Generic Credential and add URL LINK only Domain and add user name & password Finished.

git add . git commit -m "init" git remote add origin YourUrlRepo git push -u origin -all

Upvotes: 1

ManojDexter
ManojDexter

Reputation: 31

In my case, I had to provide the Personal Access Token (PAT) that was created when I created a new Azure Organization, instead of any password. This PAT needs to be saved by you since it will not be available later after you close the PAT screen.

I had forgotten my PAT and had to regenerate it and provide it for the Git login, for this issue to resolve.

Upvotes: 0

canerkaseler
canerkaseler

Reputation: 7478

I had a same problem because of saved login info in Macbook.

  1. I entered Key Chain Access App of Mac.
  2. Then, I found login info under login, opened it.
  3. I updated password with my Credential Password of Azure Repo. (Click "Generate Git Credentials")
  4. Done! Now, I can pull my branch in SourceTree.

enter image description here

Upvotes: 1

whoami - fakeFaceTrueSoul
whoami - fakeFaceTrueSoul

Reputation: 17915

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/

Upvotes: 139

Astrophage
Astrophage

Reputation: 1429

I suddenly had the same problem. It turned out to be a problem with my local station and the Internet adapter being rejected leading to not authenticated. Disabling IPV6 solved the problem for me: See https://stackoverflow.com/a/69712045/7302498

Upvotes: 0

axelio
axelio

Reputation: 197

Adding token before dev.azure in URL settings worked for me. I am using SourceTree.

https://[email protected]/org/_git/repo

Upvotes: 1

Vikas Srivastava
Vikas Srivastava

Reputation: 119

  1. Login into Azure Dev Ops portal.
  2. Go to Project you wish to clone.
  3. Select Repo from left menu.
  4. Click on Clone from right top corner.
  5. Click Generate Git Credential
  6. Enter given username & password where you are cloning repository.
  7. you are done!

Upvotes: 11

Tejashree
Tejashree

Reputation: 810

If you unable to clone the projects/repos,

  • Check proxy settings or VPN if provided
  • Check repository path access
  • Check your access or password expiry

If you are facing login issue,

  • Generate PAT (Personal Access token) for respective version control system like Git, Azure etc.
  • If PAT fails, create alternate credentials
  • If this both are right and still you are unable to access then
    1. Goto your repository click on Clone button, there you can find Generate Credentials button. Try to login with those newly generated credentials.

Check for all above options first. If you are following everything and still facing issues then try to take help from colleagues/team leader/ manager or client.

Upvotes: 1

James Burnett
James Burnett

Reputation: 171

I got this error in Visual studio because I used the sync feature when the branch hadn't been created in 'https://dev.azure.com/foo/bar' yet.

Instead of doing a sync, I did a push & then it prompted me for my credentials. After that it worked fine.

Hopefully this helps someone.

Upvotes: 1

Romeo
Romeo

Reputation: 1831

If you are using Sourcetree and you tried all of the answers here and nothing works.

try cloning your project again using this url structure as source:

https://<username>:<password>@dev.azure.com/project-name/apps/_git/library/

username and password comes from the Generate Git Credentials button when you clone your branch.

Upvotes: 0

Abdullah Tahan
Abdullah Tahan

Reputation: 2129

I had to do it this way

  1. Generate Git Credentials
  2. git remote add origin https://username:[email protected]/xxx/_git/xxx
  3. git add.
  4. git commit -m init
  5. push -u origin --all

Upvotes: 2

d1p3
d1p3

Reputation: 39

Current Azure Structure for adding credential

Use the highlighted user, password, confirm password section to create an user credential. Use this to proceed where you were stuck.

Upvotes: 3

NoloMokgosi
NoloMokgosi

Reputation: 1708

Using Mac I had the same issue. Using Git Credential manager worked.

Don't be surprised when you see PAT (Personal Access Token) in you settings.

"Once authenticated, the credential manager creates and caches a personal access token for future connections to the repo. Git commands that connect to this account won't prompt for user credentials until the token expires. A token can be revoked through Azure Repos."

Below link should help

https://learn.microsoft.com/en-us/azure/devops/repos/git/set-up-credential-managers?view=azure-devops

Upvotes: 0

Donal
Donal

Reputation: 31

Some of the above brought me close, such as the post by @Nilay Vishwakarma but I finally found the cause of my authentication issue to be that my password contained a '$' followed by a '..u7' which I eventually noticed in powershell was highlighted yellow when I typed.

I thus assumed it could be the CLi has an issue with this character in passwords (even though it wasn't mentioned as a reserved character in this tutorial).

I re-ran the 'az webapp deployment user set --user-name [user] --password [pwd]' command with a revised password without the '$' and was able to then enter my credentials and authenticate.

Upvotes: 0

tafchad
tafchad

Reputation: 3735

Using SSH instead of HTTPS worked for me after adding my SSH key

Upvotes: 2

Nilay Vishwakarma
Nilay Vishwakarma

Reputation: 3363

None of the above solution worked for me.

The reason why the same error was observed in my deployment was because my password contained a character "@".

This malformed the Git clone url for my Azure web app. When I changed my password by removing @, it solved this issue. You can change @ to %40 in your connection string as well.

Upvotes: 4

Gloria
Gloria

Reputation: 1

Navigate to the Deployment Center >> Deployment Credentials, there will be application credentials for local git. Use the username and password there will work.

Upvotes: 0

nshathish
nshathish

Reputation: 425

In my case none of the above methods solved my issue (but they directed me to find out where I'm going wrong)

I tried both auto generated App credentials and my custom created user credentials, and every time I was getting authentication failed message.

The description on the credentials page was advising me to have the username in the following format:
<app-name>\<username>

This was why authentication failed. As soon as I put my username without the <app-name> prefix the authentication passed and everything worked smoothly.

Hope this information helps

Upvotes: 0

vizmi
vizmi

Reputation: 2032

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.

Upvotes: 25

Thomas M
Thomas M

Reputation: 339

I had a similar problem where the automatically generated git clone url was:

https://[email protected]/site.git

So instead I had to replace this with my own account username

https://[email protected]/site.git 

This then prompted me for the password for my account correctly:

git clone https://[email protected]/site.git 

Upvotes: 1

mahesh
mahesh

Reputation: 237

this may help: with my first webapp, i had to go to Deployment Center, Deployment Credentials. And then use either the App Credentials or create User Credentials. After this, delete the cached credentials on the local machine (windows: Control Panel\User Accounts\Credential Manager). run "git push webapp master:master" again, enter either of the Deployment Credentials. That worked.

Upvotes: 0

Ayesha  Saeed
Ayesha Saeed

Reputation: 54

What worked for me is I created personal access token. Click username in top right corner > Security > Select Personal Access token from left pane > New Token. Provide token name and scope for your token and Click create. Save that token and use it as password.

Upvotes: 1

raga
raga

Reputation: 937

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.

Upvotes: 15

iamgilwell
iamgilwell

Reputation: 61

Go to the Security Tab >> Personal Access Tokens >> New Toke >> Give it Full Access >> Note the Access token as you will use it as your password

Upvotes: 0

kztd
kztd

Reputation: 3415

On mine, the password was never created when I set the deployment user from the cli. I had to go to the web app, app services, for the app, then set the deployment credentials

Upvotes: 0

Prasanth Louis
Prasanth Louis

Reputation: 5056

For me it was a matter of cloning the project with the remote url and cancelling the windows security prompt. Afterwards, it'll ask you for the password. Once you're able to clone it, you can push it successfully.

Moral of the story: Clone it first before pushing.

Upvotes: 0

Joseph
Joseph

Reputation: 6031

I had the same problem when try to git clone https://<username>@praat.scm.azurewebsites.net:443/<repo-name>.git . I solved the problem by removing the port.

So your new url should not have the port 443.

Upvotes: 6

citleon
citleon

Reputation: 388

In my case it looks like azure server is slowing down.

Git deployment

git push azure master

fatal: Authentication failed for

FTP deployment

Authentification - OK upload speed 1-10K

Upvotes: -1

Related Questions