Azure Git 身份验证失败

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34837173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:52:08  来源:igfitidea点击:

Authentication failed for Azure Git

gitazureazure-web-sites

提问by Arn Vanhoutte

I'm trying to clone my webapp in Azure.

我正在尝试在 Azure 中克隆我的 webapp。

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

当我运行git clone https://[email protected]:443/appname.git终端时,会询问我的密码。

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?

有什么理由一直说我的身份验证失败?

回答by vizmi

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

我的网站遇到了同样的问题,结果问题出在网站 url 上:自动生成的远程 url 是:https://[email protected]/site.git

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

另一方面,门户显示:https://[email protected]:443/site.git

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

使用以下命令更新 git 中的远程 url 后:

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.

故事的士气:检查部署 url 以及密码。

回答by raga

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

  1. 检查您设置的 Azure URL

    git config --get remote.<azure-remote-name>.url
    
  2. 使用以下命令重置 azure url

    git remote set-url <azure-remote-name>
    https://<user>@<sitename>[_<slotName>].scm.azurewebsites.net:443/<site>.git
    
  3. 尝试使用推送您的代码

    git push <azure-remote-name>
    
  4. 它将打开 Windows 身份验证屏幕,显示输入凭据以连接到 https://<user>@<sitename>[_<slotName>].scm.azurewebsites.net/<site>.git

  5. 取消这个窗口。它将提示基本凭据窗口,提示输入凭据以连接到https://<user>@<sitename>[_<slotName>].scm.azurewebsites.net:433/<site>.git

Enter in your credential and it works.

输入您的凭据,它可以工作。

回答by whoami

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.

是的,这里的许多答案都指向正确的路径,但我的情况是:- 我得到了一个 url 来访问 azure cloud 上的 git repos,当我访问/浏览浏览器(Vs)上的代码时,我完全没问题我正在尝试克隆我遇到了同样的问题。

So when you click on cloneas 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. enter image description here

所以当你点击如下图所示的克隆时,你必须生成 Git 凭证,这很奇怪,不知道为什么,可能他们已经设置了我的帐户来访问 azure cloud,它不能用于克隆 git repos (意味着不能用作 git 凭证),这与我在 AWS/gitlab/bitbucket 上看到的有所不同,可能是帐户设置问题,或者对于 Azure 上的 repos 来说是否很常见,如果您是在同样的问题 - 试一试。在此处输入图片说明

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

另一个,正如每个人已经提到的,请不要尝试连接到那里产生的 url(看起来像):

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

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

而是尝试通过您的 GIT 用户名进行连接,然后使用密码:

https://[email protected]/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. :-

作为提示,如果您的用户名中包含特殊字符,Git cmd/bash 将通过错误,因此将这些替换为有效字符,例如。:-

  1. @ can be replaced with %40
  2. + can be replaced with %2B
  1. @ 可以替换为 %40
  2. + 可以替换为 %2B

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

就像是 : https://username%[email protected]/project-name/apps/_git/library/

回答by Joseph

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.

尝试时我遇到了同样的问题git clone https://<username>@praat.scm.azurewebsites.net:443/<repo-name>.git。我通过删除端口解决了这个问题。

So your new url should not have the port 443.

所以你的新网址不应该有端口443

回答by CodeWizard

Since azuredoes 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)

由于azure不支持 ssh,因此您必须至少使用一次密码(在某些情况下,下次不会提示您输入密码)

Here is an article describe how to set it up

这里有一篇文章描述了如何设置它

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

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

以下是如何使用 Azure 设置 git: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.

如果这是您第一次在 Azure 中设置存储库,则需要为其创建登录凭据

您将使用它们登录到 Azure 存储库并从本地 Git 存储库推送更改。从您的 Web 应用程序的边栏选项卡中,单击Settings > Deployment credentials,然后配置您的部署用户名和密码。

完成后,单击“确定”。

Now do this:

现在这样做:

enter image description here

在此处输入图片说明

回答by Nilay Vishwakarma

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 %40in your connection string as well.

这使我的 Azure Web 应用程序的 Git 克隆 URL 格式错误。当我通过删除@ 更改密码时,它解决了这个问题。您也可以%40在连接字符串中将@ 更改为。

回答by Thomas M

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

我有一个类似的问题,其中自动生成的 git clone url 是:

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 

回答by mathewc

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

假设您每次都输入正确的密码,则可能是延迟/传播问题。

You can also use your Site-Level credentialsas 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.PublishSettingsfile and will look something like userName="$yourapp" userPWD="ABC123". This is only mentioned as a workaround if your User-Levelcredentials are not working (which they should be if they are correct).

您还可以使用您的站点级别凭据如此 wiki 页面 中所述。您可以通过主 WebApp 栏上的“获取发布配置文件”选项在门户中下载您的发布凭据来获取这些信息。然后可以在yourapp.PublishSettings文件中找到用户名/密码,看起来像userName="$yourapp" userPWD="ABC123". 如果您的用户级凭据不起作用(如果它们正确,它们应该是),这仅作为一种解决方法被提及。

回答by Brij Raj Singh - MSFT

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.

解决此问题的直接方法是从主工具栏下载/获取发布配置文件(确保刷新门户页面)并使用 .publishsettings 文件中给出的密码。

回答by Prasanth Louis

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.

对我来说,这是使用远程 url 克隆项目并取消 Windows 安全提示的问题。之后,它会要求您输入密码。一旦您能够克隆它,您就可以成功推送它。

Moral of the story: Clone it first before pushing.

这个故事的寓意:在推动之前先克隆它。