1

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 git@github.com: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 git@github.com command:

$ ssh -vT git@github.com

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: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com 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.

tamj0rd2
  • 3,745
  • 2
  • 20
  • 21

1 Answers1

1

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.

  1. Installed OpenSSH for Windows (OpenSSH_for_Windows_7.7p1) from http://www.mls-software.com/opensshd.html. I've just found out that it's also available through the Windows 10 Creators Update

After installing and reopening PowerShell, running ssh -vT git@github.com 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

  1. To fix the ssh-agent problem I only needed to enable the 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.

  1. To fix the final issue with the git commands, I set the 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.

tamj0rd2
  • 3,745
  • 2
  • 20
  • 21