Authentication failed for Azure Git

不打扰是莪最后的温柔 提交于 2020-03-17 08:18:21

问题


I'm trying to clone my webapp in Azure.

When I run git clone https://username@appname.scm.azurewebsites.net: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?


回答1:


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://user@site.scm.azurewebsites.net/site.git

On the other hand the portal showed: https://user@site.scm.azurewebsites.net: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.




回答2:


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.




回答3:


Yes many of the answers here are pointing to the correct path, but my case:- I was given an 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 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 & if you're in same issue - give it a try.

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

https://project-account@dev.azure.com/project-name/apps/_git/library/

instead try to connect thru your GIT username & then use password :

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

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

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

something like : https://username%40xyz.com@dev.azure.com/project-name/apps/_git/library/




回答4:


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.




回答5:


Since azure does not support ssh you will have to use your password at least once (in some cases you will not be prompt for password next time)

Here is an article describe how to set it up

https://azure.microsoft.com/en-us/documentation/articles/web-sites-publish-source-control/

And here is how to set up git with Azure: http://weblogs.asp.net/shijuvarghese/building-and-deploying-windows-azure-web-sites-using-git-and-github-for-windows


Here are the steps that you followed

If this is your first time setting up a repository in Azure, you need to create login credentials for it.

You will use them to log into the Azure repository and push changes from your local Git repository. From your web app's blade, click Settings > Deployment credentials, then configure your deployment username and password.

When you're done, click OK.

Now do this:




回答6:


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.




回答7:


Assuming you're entering the correct password each time, it might be a delay/propagation issue.

You can also use your Site-Level credentials as detailed on this wiki page. You can get these by downloading your publishing credentials in the Portal via the "Get Publish Profile" option on your main WebApp bar. The user name / password can then be found in the yourapp.PublishSettings file and will look something like userName="$yourapp" userPWD="ABC123". This is only mentioned as a workaround if your User-Level credentials are not working (which they should be if they are correct).




回答8:


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

https://group-admin-account-username@dev.azure.com/site.git

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

https://my-username@dev.azure.com/site.git 

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

git clone https://my-username@dev.azure.com/site.git 



回答9:


A straight forward method to get this over with is to Download/Get Publish profile (make sure you refresh the portal page) from main toolbar and use the password given in the .publishsettings file.




回答10:


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.




回答11:


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




回答12:


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




回答13:


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.




回答14:


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.




回答15:


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




回答16:


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




回答17:


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



来源:https://stackoverflow.com/questions/34837173/authentication-failed-for-azure-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!