0

I have a Windows 7 machine to which I have SSH access. I want to clone a git repo in a particular directory in that machine using SSH protocol. I am trying to clone the repo by logging into the remote Windows 7 machine using SSH(PuTTY) but I get the following error at the console:

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.

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

But I am able to clone the same repo if I do it via Remote Desktop(mstsc) or VNC viewer. Can someone help me with what is missing here in the PuTTY approach? Eventually, I want to automate the cloning process using Python & fabric.

Here's the output of ssh [email protected] -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: [email protected]
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
Rakesh K
  • 8,237
  • 18
  • 51
  • 64

1 Answers1

0

Perhaps a credential helper does the job?

In the end git config --list --show-origin should look like this:

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

For details see this question.

Christoph
  • 6,841
  • 4
  • 37
  • 89
  • here's what i see: file:"C:\\Program Files\\Git\\mingw64/etc/gitconfig" credential.helper=manager but no credential helpers in /user/.gitconfig – Rakesh K Dec 05 '17 at 16:19
  • What do you mean? My suggestion was about git config, not ssh output. – Christoph Dec 05 '17 at 16:22
  • ok, so should i have the `credential.helper=wincred' in the .gitconfig file? – Rakesh K Dec 05 '17 at 16:24
  • Yes, this may be an option. Actually, that is the way, I access repos it is simple and rliable. See [here](https://git-scm.com/docs/gitcredentials). – Christoph Dec 05 '17 at 16:32