"fatal: Authentication failed" 与 git-credential-manager
"fatal: Authentication failed" with git-credential-manager
我第一次使用 Azure DevOps 来托管我的下一个项目。当我在 Azure Devops 上创建一个空项目时,我尝试克隆它。在尝试克隆时,它要求我输入密码。我输入了它,它说我的密码有误,但我知道我输入的密码是正确的。
然后我为 max/linux 安装了 git-credential-manager 到我的 mac。我尝试从远程来源执行 git pull
,但它只是像第一次一样提示输入密码,但失败了。
我还尝试在 Azure Devops 上使用“创建 git 凭据”功能,我可以在其中指定一个新密码。同样的错误也失败了。
我在他们的存储库 here 上提交了一个 GitHub 问题。我没有办法克隆我的项目吗?我存储库的 url 格式为 https://yousefshanawany@dev.azure.com/...
.
更新:我在我的 Windows machine 上试过这个,它给了我一个登录弹出窗口,它工作正常。
确保您的 git 凭据助手已向您的本地 Git:
声明
git config credential.helper
如果输出为空,输入:
git config --global credential.helper manager-core
然后重试。
然而,OP AskYous correctly pinpoint another issue :
Can I tell it what my username is?
I think my username is my email address, because I use my organization account to sign in.
在这种情况下,URL 将是:
https://me%40email.com@dev.azure.com/yousefshanawany/<repo-name>/
请注意电子邮件的 @
必须是 percent-encoded。
注意 using a PAT (Personal Access Token) is an alternative mentioned , and mandatory if you have 2FA activated.
2019 年 6 月更新:此问题已在 microsoft/Git-Credential-Manager-for-Mac-and-Linux
issue 104, which just got closed with a comment from John Briggs from Microsoft 中引用:
I'd recommend trying GCM Core's macOS preview release
Maksym Pecheniuk points out :
solution for IntelliJ Idea: "Git IntelliJ "Authentication Failed”"
是的,所以我和我的同事遇到了同样的麻烦(在 windows 上没有这个问题,只有 mac 上有这个问题)并且上面的解决方案对他有用但没有用为了我。我必须通过本指南创建个人访问令牌 (PAT) Authenticate Access With Personal Access Tokens。
然后在 iTerm 中:
git 克隆 https://octavialo%40organizationname:abcBFJreallylongtokenstringGHYKLjjsjks@dev.azure.com/organizationname/reponame
%40 是 @ 符号的替代。我使用 octavialo@organizationname.com
登录到 azure
我也尝试过这个,其中 foobar 是我给令牌的名称:
git 克隆 https://foobar:abcBFJreallylongtokenstringGHYKLjjsjks@dev.azure.com/organizationname/
我认为问题可能出在我的密码上,其中包含特殊字符。
我找到的一个解决方案是使用个人访问令牌 (PAT)。它位于 "clone" 选项卡中。它工作起来非常容易。
解决我的问题的方法是:
创建存储库
从存储库视图中,使用 name
和 password
创建您的凭据
现在在控制台中,您可以通过更改 azure 为您提供的 url 初始值来克隆您的存储库
git clone https://<companyname>@dev.azure.com/<companyname>/<project name>/_git/<repository name>
到
git clone https://<your credentials name>@dev.azure.com/<companyname>/<project name/_git/<repository name>
现在它会要求您输入密码。您必须使用您在创建凭据时提供的凭据。
同样的错误(Windows,Git Bash命令行)。使用 https(不是 ssh)应该提示输入登录凭据但错误:
$ git pull origin master
fatal: Authentication failed for 'https://github.com/frmbelz/my_git_project.git'
$ git config -l
...
credential.helper=manager
...
$ git config --global --unset credential.helper
$ git config --system --unset credential.helper
git pull
现在提示 username/password 提示。
我在我的 git 推送命令中添加了 sudo,系统提示我输入我的 github 凭据并且它起作用了
sudo git push
FWIW,我发现我必须使用 Git-Credential-Manager-Core 实用程序:
您可以通过 运行 重新配置 Git 凭据管理器:
git credential-manager-core configure
结果:
Configuring component 'Git Credential Manager'...
Configuring component 'Azure Repos provider'...
我第一次使用 Azure DevOps 来托管我的下一个项目。当我在 Azure Devops 上创建一个空项目时,我尝试克隆它。在尝试克隆时,它要求我输入密码。我输入了它,它说我的密码有误,但我知道我输入的密码是正确的。
然后我为 max/linux 安装了 git-credential-manager 到我的 mac。我尝试从远程来源执行 git pull
,但它只是像第一次一样提示输入密码,但失败了。
我还尝试在 Azure Devops 上使用“创建 git 凭据”功能,我可以在其中指定一个新密码。同样的错误也失败了。
我在他们的存储库 here 上提交了一个 GitHub 问题。我没有办法克隆我的项目吗?我存储库的 url 格式为 https://yousefshanawany@dev.azure.com/...
.
更新:我在我的 Windows machine 上试过这个,它给了我一个登录弹出窗口,它工作正常。
确保您的 git 凭据助手已向您的本地 Git:
声明git config credential.helper
如果输出为空,输入:
git config --global credential.helper manager-core
然后重试。
然而,OP AskYous correctly pinpoint another issue
Can I tell it what my username is?
I think my username is my email address, because I use my organization account to sign in.
在这种情况下,URL 将是:
https://me%40email.com@dev.azure.com/yousefshanawany/<repo-name>/
请注意电子邮件的 @
必须是 percent-encoded。
注意 using a PAT (Personal Access Token) is an alternative mentioned
2019 年 6 月更新:此问题已在 microsoft/Git-Credential-Manager-for-Mac-and-Linux
issue 104, which just got closed with a comment from John Briggs from Microsoft 中引用:
I'd recommend trying GCM Core's macOS preview release
Maksym Pecheniuk points out
solution for IntelliJ Idea: "Git IntelliJ "Authentication Failed”"
是的,所以我和我的同事遇到了同样的麻烦(在 windows 上没有这个问题,只有 mac 上有这个问题)并且上面的解决方案对他有用但没有用为了我。我必须通过本指南创建个人访问令牌 (PAT) Authenticate Access With Personal Access Tokens。
然后在 iTerm 中: git 克隆 https://octavialo%40organizationname:abcBFJreallylongtokenstringGHYKLjjsjks@dev.azure.com/organizationname/reponame
%40 是 @ 符号的替代。我使用 octavialo@organizationname.com
登录到 azure我也尝试过这个,其中 foobar 是我给令牌的名称: git 克隆 https://foobar:abcBFJreallylongtokenstringGHYKLjjsjks@dev.azure.com/organizationname/
我认为问题可能出在我的密码上,其中包含特殊字符。
我找到的一个解决方案是使用个人访问令牌 (PAT)。它位于 "clone" 选项卡中。它工作起来非常容易。
解决我的问题的方法是:
- 创建存储库
从存储库视图中,使用
name
和password
创建您的凭据现在在控制台中,您可以通过更改 azure 为您提供的 url 初始值来克隆您的存储库
git clone https://<companyname>@dev.azure.com/<companyname>/<project name>/_git/<repository name>
到
git clone https://<your credentials name>@dev.azure.com/<companyname>/<project name/_git/<repository name>
现在它会要求您输入密码。您必须使用您在创建凭据时提供的凭据。
同样的错误(Windows,Git Bash命令行)。使用 https(不是 ssh)应该提示输入登录凭据但错误:
$ git pull origin master
fatal: Authentication failed for 'https://github.com/frmbelz/my_git_project.git'
$ git config -l
...
credential.helper=manager
...
$ git config --global --unset credential.helper
$ git config --system --unset credential.helper
git pull
现在提示 username/password 提示。
我在我的 git 推送命令中添加了 sudo,系统提示我输入我的 github 凭据并且它起作用了
sudo git push
FWIW,我发现我必须使用 Git-Credential-Manager-Core 实用程序:
您可以通过 运行 重新配置 Git 凭据管理器:
git credential-manager-core configure
结果:
Configuring component 'Git Credential Manager'...
Configuring component 'Azure Repos provider'...