1

I am a gitnewbie trying to clone my githubrepo with ssh. I followed these steps: https://help.github.com/articles/generating-an-ssh-key/.

Working in a proxy environment so got a gut feeling it might be related to this. When I go:git clone [email protected]:myuser/myrepo.git, i get this error:

ssh: connect to host github.com port 22: Connection timed out

How can I fix this error?

1 Answer 1

2

You can fix it the same way you'd fix any ssh problem. Remove Git from the equation and just try to log in using ssh. If it works you should see something like this.

$ ssh [email protected]
PTY allocation request failed on channel 0
Hi schwern! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.

If it doesn't work, you need to debug your ssh session. Usually you do this by using ssh -v (and you can add more -v's for more verbosity).

$ ssh -v [email protected]
OpenSSH_7.1p2, OpenSSL 1.0.2e 3 Dec 2015
debug1: Reading configuration data /opt/local/etc/ssh/ssh_config
debug1: Connecting to example.com [93.184.216.34] port 22.

If it hangs at this point, the either you can't connect to the host at all, or it doesn't have an ssh server listening on port 22, or the port is blocked by a firewall.

Since this is Github which definitely has an ssh server and is working for me, I suspect the last one: you're behind a firewall. You can test this by trying to ssh to somewhere else.

In that case either use a VPN to get around the firewall, or try using an HTTPS connection instead.

git clone https://github.com/myuser/myrepo.git
Sign up to request clarification or add additional context in comments.

1 Comment

And if the firewall is blocking, you can use an alternate port.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.