首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在WSL上通过SSH到Azure DevOps的Git失败,“权限被拒绝(密码,公开密钥)”。

在WSL上通过SSH到Azure DevOps的Git失败,“权限被拒绝(密码,公开密钥)”。
EN

Stack Overflow用户
提问于 2022-03-29 01:25:06
回答 1查看 805关注 0票数 1

我试图克隆我们的一个存储库,但是总是提示我输入{myco}@vs-ssh.visual alstudio.com的密码。我的环境是WSL,Pengwin (本质上是Debian),最新的git。~/..ssh内容:

代码语言:javascript
运行
复制
-rw------- 1 val val  738 Dec  2 21:09 authorized_keys
-rwx------ 1 val val  562 Mar 28 20:21 config*
-r-------- 1 val val  399 Mar 28 17:42 id_ed25519
-r-------- 1 val val   93 Mar 28 17:42 id_ed25519.pub
-r-------- 1 val val 1.8K Mar 28 17:42 id_rsa
-r-------- 1 val val 1.8K Mar 28 20:04 id_rsa_ado
-r-------- 1 val val  393 Mar 28 20:04 id_rsa_ado.pub
-r-------- 1 val val  394 Mar 28 17:42 id_rsa.pub
-rw-r--r-- 1 val val 3.9K Mar 10 11:20 known_hosts

在Azure DevOps上:

代码语言:javascript
运行
复制
Name id_rsa_ado.pub
Fingerprint 39:03:4b:6e:4b:3b:92:6c:c9:c0:f5:c2:b6:bc:8c:da

在我的机器上:

代码语言:javascript
运行
复制
❯ ssh-keygen -l -E md5 -f ~/.ssh/id_rsa_ado
2048 MD5:39:03:4b:6e:4b:3b:92:6c:c9:c0:f5:c2:b6:bc:8c:da Val Melamed (RSA)

~/..ssh/config的内容:

代码语言:javascript
运行
复制
CanonicalizeHostname yes

Host github.com
  HostName github.com
  IdentityFile ~/.ssh/id_ed25519

Host vs-ssh.visualstudio.com
  HostName vs-ssh.visualstudio.com
  User {myco}
  IdentityFile ~/.ssh/id_rsa_ado

Host vs-ssh.visualstudio.com
  HostName vs-ssh.visualstudio.com
  User {myco}
  IdentityFile ~/.ssh/id_rsa_ado

Host *
  User git
  ForwardAgent yes
  AddKeysToAgent yes
  LogLevel FATAL
  ServerAliveInterval 300
  TCPKeepAlive no
  IdentitiesOnly yes

请注意,对于用户,我尝试了"git“和"{myco}”,结果相同。

SSH测试通过:

代码语言:javascript
运行
复制
❯ ssh -Tv {myco}@vs-ssh.visualstudio.com
OpenSSH_8.4p1 Debian-5, OpenSSL 1.1.1n  15 Mar 2022
debug1: Reading configuration data /home/val/.ssh/config
debug1: /home/val/.ssh/config line 7: Applying options for vs-ssh.visualstudio.com
debug1: /home/val/.ssh/config line 12: Applying options for vs-ssh.visualstudio.com
debug1: /home/val/.ssh/config line 17: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: hostname canonicalisation enabled, will re-parse configuration
debug1: re-parsing configuration
debug1: Reading configuration data /home/val/.ssh/config
debug1: /home/val/.ssh/config line 7: Applying options for vs-ssh.visualstudio.com
debug1: /home/val/.ssh/config line 12: Applying options for vs-ssh.visualstudio.com
debug1: /home/val/.ssh/config line 17: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to vs-ssh.visualstudio.com [20.41.6.12] port 22.
debug1: Connection established.
debug1: identity file /home/val/.ssh/id_rsa_ado type 0
debug1: identity file /home/val/.ssh/id_rsa_ado-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5
debug1: Remote protocol version 2.0, remote software version SSHBlackbox.10
debug1: no match: SSHBlackbox.10
debug1: Authenticating to vs-ssh.visualstudio.com:22 as 'thycotic'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<8192<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:ohD8VZEXGWo6Ez8GSEJQ9WpafgLFsOfLOtGGQCQo6Og
debug1: Host 'vs-ssh.visualstudio.com' is known and matches the RSA host key.
debug1: Found key in /home/val/.ssh/known_hosts:12
debug1: rekey out after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 4294967296 blocks
debug1: Will attempt key: /home/val/.ssh/id_rsa_ado RSA SHA256:lxYw6Y7pOlaF68Hwovn7xiQrT7DKZjEuZFR3AnlZW7Q explicit agent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: password,publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /home/val/.ssh/id_rsa_ado RSA SHA256:lxYw6Y7pOlaF68Hwovn7xiQrT7DKZjEuZFR3AnlZW7Q explicit agent
debug1: Server accepts key: /home/val/.ssh/id_rsa_ado RSA SHA256:lxYw6Y7pOlaF68Hwovn7xiQrT7DKZjEuZFR3AnlZW7Q explicit agent
debug1: Authentication succeeded (publickey).
Authenticated to vs-ssh.visualstudio.com ([20.41.6.12]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Requesting authentication agent forwarding.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
remote: Shell access is not supported.
shell request failed on channel 0

克隆失败了:

代码语言:javascript
运行
复制
❯ sudo git clone {myco}@vs-ssh.visualstudio.com:v3/{myco}/{project}/{repo}
Cloning into '{repo}'...
{myco}@vs-ssh.visualstudio.com's password:
Permission denied, please try again.
{myco}@vs-ssh.visualstudio.com's password:
Permission denied, please try again.
{myco}@vs-ssh.visualstudio.com's password:
{myco}@vs-ssh.visualstudio.com: Permission denied (password,publickey).
fatal: Could not read from remote repository.

{}大括号中的内容当然是我的公司、项目和存储库的占位符。

所有这一切过去是可行的,然后它停止了上述行为。尝试了很多事情,产生了一个新的键(上面),但是没有骰子.有人看到我错过了什么或者做错了什么吗?

EN

回答 1

Stack Overflow用户

发布于 2022-03-29 01:36:48

我在sudo前面删除了git clone并修复了它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71655428

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档