简体   繁体   English

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

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

Trying to clone a git repository in Windows vscode from a private Linux host (SSH / client RSA key)尝试从私有 Linux 主机(SSH / 客户端 RSA 密钥)克隆 Windows vscode 中的 git 存储库

What is OK:什么是好的:

  • In a command prompt, git clone ssh://gituser@... (passphrase request)在命令提示符下, git clone ssh://gituser@... (密码请求)
  • connection with the vscode "Remote-SSH" extension (passphrase request)与 vscode “Remote-SSH” 扩展的连接(密码请求)

The problem:问题:

  • In vscode, "Clone Git Repository..." fails without passphrase request: "Permission denied, please try again.gituser@192.168.1.18: Permission denied (publickey,password).fatal: Could not read from remote repository."在 vscode 中,“克隆 Git 存储库...”在没有密码请求的情况下失败:“权限被拒绝,请再试一次。gituser@192.168.1.18:权限被拒绝(公钥,密码)。致命:无法从远程存储库读取。”

成功的 git 克隆

vscode git克隆请求

vscode 错误

host sshd log:主机 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
...

From the CMD where the clone does work, type从克隆工作的 CMD 中,键入

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

From there, try and clone again, this time checking what SSH key is actually used in that new VSCode session.从那里,再次尝试克隆,这次检查新的 VSCode 会话中实际使用的 SSH 密钥。

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

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