简体   繁体   中英

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)

What is OK:

  • In a command prompt, git clone ssh://gituser@... (passphrase request)
  • connection with the vscode "Remote-SSH" extension (passphrase request)

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."

成功的 git 克隆

vscode git克隆请求

vscode 错误

host sshd log:

...
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

  • 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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