问题描述
我正在尝试将git仓库从PowerShell推送到Azure DevOps仓库,并且在尝试推送时会不断出现不同的身份验证错误.
I am trying to push a git repo from PowerShell into an Azure DevOps repo, and I keep getting different auth errors when trying to push it.
我希望有人可以对我的检查内容有所了解,并做一个正确的演练.
I am hoping somebody can shed some light on what I check, and do a proper walkthrough.
例如,
git remote add origin [email protected]:v3/MyAzure/MyProject/MyRepo
git push -u origin --all
我不断得到:
我已经输入了各种各样的密码,但是仍然失败.它在说哪个密码?
I've input all sorts of passwords, but it's still failing. Which password is it talking about?
或者,我也得到了:
致命:无法从远程存储库读取.
fatal: Could not read from remote repository.
请确保您具有正确的访问权限,并且存储库存在.
Please make sure you have the correct access rights and the repository exists.
验证:
$ ssh -T [email protected]
ssh: connect to host mycompany.com port 22: Connection refused
我已经执行以下操作:
- 在Azure DevOps中创建存储库
- 按照Microsoft文档的说明,使用git-bash创建SSH密钥,将其复制并粘贴到Azure DevOps安全中.
- 转到我的个人资料/安全信息,并添加了一个SSH密钥(在git-bash中生成)
- Created a repo in Azure DevOps
- Created a SSH key using git-bash, as per Microsoft's documentation, copied and pasted without spaces into Azure DevOps security.
- Gone to my profile/security and added an SSH key (generated in git-bash)
我想念明显的东西吗?使用个人访问令牌会更好吗?谁能提供正确步骤的演练?
Am I missing the obvious? Is it better to use personal access token? Can anyone provide a walk through of the correct steps?
推荐答案
我相信@Schalton的评论是正确的:SSH验证失败,因此会提示通过.
I believe @Schalton's comment is right: SSH validation is failing, so it prompts for the pass.
有同样的问题.通过生成密钥作为默认值('id_rsa')而不是使用其他名称(尝试使用其他名称,但没有一个起作用)来解决".
Had the same problem. "Solved it" by generating the key as the default value ('id_rsa') instead of using other names (tried other names and none of them worked).
[####@#### .ssh]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/guille/.ssh/id_rsa): id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in id_rsa.
Your public key has been saved in id_rsa.pub.
正如@LHM所指出的,在括号中显示了用于保存密钥的文件的默认值(无需输入).
As noted by @LHM the value default (no input needed) for the file in which to save the key is showed in parenthesis.
这篇关于在Azure DevOps上使用git进行Git SSH公钥身份验证失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!