远程窗口中的git clone不起作用

时间:2017-12-05 15:27:01

标签: python git

我有一台Windows 7机器,我有SSH访问权限。我想使用SSH协议在该机器的特定目录中克隆一个git repo。我试图通过使用SSH(PuTTY)登录到远程Windows 7计算机来克隆存储库但是我在控制台上收到以下错误:

git@xyz-github.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

但是如果我通过远程桌面(mstsc)或VNC查看器进行复制,我可以克隆相同的回购。有人可以帮助我解决PuTTY方法中缺少的内容吗?最后,我想使用Python& amp;来自动化克隆过程。织物

这是ssh git@xyz-github.com -v的输出:

OpenSSH_7.6p1, OpenSSL 1.0.2m  2 Nov 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xyz-github.com [xxx.yyy.zzz.www] port 22.
debug1: Connection established.
debug1: identity file /c/Users/admin/.ssh/id_rsa type 0
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/admin/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/admin/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/admin/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/admin/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/admin/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/admin/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /c/Users/admin/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.6
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to xyz-github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
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: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:YppvE1IGqHnKCcW9FqBzT4wBdyHxS0XBChnQNu4zCn0
debug1: Host 'xyz-github.com' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/admin/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:yJ5QUUudzMLgW4w8x1o5idxyGbqmeoLilEPiKQnM5gs /c/Users/admin/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to xyz-github.com ([xxx.yyy.zzz.www]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
PTY allocation request failed on channel 0
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Hi rakesh! You've successfully authenticated, but GitHub does not provide shell access.
debug1: channel 0: free: client-session, nchannels 1
Connection to xyz-github.com closed.
Transferred: sent 2880, received 1384 bytes, in 0.5 seconds
Bytes per second: sent 5594.4, received 2688.4
debug1: Exit status 1

1 个答案:

答案 0 :(得分:0)

也许是凭证助手完成这项工作?

最后git config --list --show-origin应如下所示:

file:"C:\\Git\\mingw64/etc/gitconfig"   credential.helper=manager
file:C:/Users/user/.gitconfig    credential.helper=wincred
file:.git/config        remote.origin.url=https://github.com/xy

有关详细信息,请参阅this question