Reputation: 5700
I've done a fresh install of Git (version 2.20.1.windows.1) on a new laptop but I'm not able to clone any of my Github repositories. I've also tried Gitlab and am having the same issue.
This is the error I get when I try to clone the Github debug repository:
$ git clone [email protected]:github/debug-repo debug-repo-ssh
Cloning into 'debug-repo-ssh'...
Received disconnect from 140.82.118.4 port 22:11: Bye Bye
Disconnected from 140.82.118.4 port 22
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Here is the output of the ssh -vT [email protected]
command:
$ ssh -vT [email protected]
OpenSSH_7.9p1, OpenSSL 1.1.1a 20 Nov 2018
debug1: Reading configuration data /c/Users/Tam/.ssh/config
debug1: /c/Users/Tam/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to github.com [140.82.118.4] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Tam/.ssh/id_github type 0
debug1: identity file /c/Users/Tam/.ssh/id_github-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version babeld-64adca0f
debug1: no match: babeld-64adca0f
debug1: Authenticating to 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: ssh-rsa
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
Received disconnect from 140.82.118.4 port 22:11: Bye Bye
Disconnected from 140.82.118.4 port 22
It doesn't even get to the point of asking me for my passphrase.
Upvotes: 2
Views: 9745
Reputation: 880
Ran into the same issue on a colleagues computer. From git bash a ssh [email protected]
against authenticated worked, where cloning did not. It turned out that the git clone
uses plink.exe
. And plink.exe
uses the default SSH -> auth identity (which was set to another key) instead of the keys loaded in pageant
. Removing the stored key in Putty (and saving that in the default session) made plink look for the corect key via pageant again.
Upvotes: 0
Reputation: 69
Tried all kinds of solutions I could find online, but none of them worked, except answer from lzag.
For people too lazy to follow the link, just add
Host github.com
IdentityFile ~/.ssh/<your ssh key>
into C:\Program Files\Git\etc\ssh\ssh_config (if that’s where you installed Git)
Upvotes: 1
Reputation: 5700
I wasn't able to figure out why git's bundled ssh isn't working on my laptop, but I've found a stable workaround.
After installing and reopening PowerShell, running ssh -vT [email protected]
asked for my passphrase and authenticated me successfully, but the git-agent
command was failing. It was an error like Could not connected to the authentication agent
OpenSSH Authentication Agent
service from services.msc. I set the launch mode to Automatic (delayed start).That got the ssh-agent
, ssh-add
and ssh-add -l
commands working, but git commands were still failing with exactly the same error as before.
SSH_GIT
environment variable to the location where I installed OpenSSH. For me that is C:\Windows\System32\OpenSSH\ssh.exe
. Here's a guide that should help.Once I did that and restarted PowerShell, git clone and all the other commands started working.
Upvotes: 4