繁体   English   中英

尽管 git 命令成功(SSH),但克隆 git repo 在 vscode 中不起作用

[英]Clone git repo not working in vscode although git command succeeds (SSH)

尝试从私有 Linux 主机(SSH / 客户端 RSA 密钥)克隆 Windows vscode 中的 git 存储库

什么是好的:

  • 在命令提示符下, git clone ssh://gituser@... (密码请求)
  • 与 vscode “Remote-SSH” 扩展的连接(密码请求)

问题:

  • 在 vscode 中,“克隆 Git 存储库...”在没有密码请求的情况下失败:“权限被拒绝,请再试一次。gituser@192.168.1.18:权限被拒绝(公钥,密码)。致命:无法从远程存储库读取。”

成功的 git 克隆

vscode git克隆请求

vscode 错误

主机 sshd 日志:

...
debug1: userauth-request for user gituser service ssh-connection method publickey [preauth]
debug1: attempt 1 failures 0 [preauth]
debug1: userauth_pubkey: test whether pkalg/pkblob are acceptable for RSA SHA256:DlTkOFDZK... [preauth]
debug1: temporarily_use_uid: 1033/100 (e=0/0)
debug1: trying public key file /var/services/homes/gituser/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: matching key found: file /var/services/homes/gituser/.ssh/authorized_keys, line 1 RSA SHA256:DlTkOFDZK...
debug1: restore_uid: 0/0
Postponed publickey for gituser from 192.168.1.132 port 5xxx1 ssh2 [preauth]

debug1: userauth-request for user gituser service ssh-connection method password [preauth]
debug1: attempt 2 failures 0 [preauth]
debug1: PAM: password authentication failed for gituser: Permission denied
Failed none for gituser from 192.168.1.132 port 5xxx1 ssh2: RSA SHA256:DlTkOFDZK...
debug1: userauth-request for user gituser service ssh-connection method password [preauth]
debug1: attempt 3 failures 1 [preauth]
debug1: PAM: password authentication failed for gituser: Permission denied
Failed password for gituser from 192.168.1.132 port 5xxx1 ssh2
debug1: Unable to open the btmp file /var/log/btmp: No such file or directory
...

从克隆工作的 CMD 中,键入

  • set "GIT_SSH_COMMAND=ssh -Tv"
  • "%LOCALAPPDATA%\Programs\Microsoft VS Code\bin\code.cmd"

从那里,再次尝试克隆,这次检查新的 VSCode 会话中实际使用的 SSH 密钥。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM