Anthony Chung
Anthony Chung

Reputation: 1477

Jenkins cannot SSH into github

Running ubuntu on EC2 instance. I want to setup Jenkins SSH with my github server, but when I run the command

ssh -vT [email protected]

I receive the following output:

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.253.113] port 22.
ssh: connect to host github.com port 22: Connection timed out

My ssh key for jenkins is located in the /var/lib/jenkins/.ssh folder, but it looks as if ssh config data is being read in the /etc/ folder

I have added the public SSH key to my github account and have verified that I did so as one line.

What else am I missing?

I came across this Creating SSH keys for Gerrit and Hudson as a potential reason why it is not connecting, but I find it highly unlikely that the last time this occurred for somebody was 5 years ago.

Upvotes: 0

Views: 790

Answers (2)

Anthony Chung
Anthony Chung

Reputation: 1477

Turns out that EC2 doesn't seem to let me connect to github via port 22. I tested this via Alex O's suggestion that I attempt to telnet into git

My solution:

  1. Use SSH through the HTTPS port
  2. Change the config file for github to ssh through 443
  3. Profit

Major cred to @AlexO

Upvotes: 0

Alex O
Alex O

Reputation: 8174

This looks more like a networking issue as you receive a Connection timed out error.

So, first check that you can really connect to the github server, e.g. using nmap or telnet; the output should look like this if networking is ok:

$ telnet github.com 22
Trying 192.30.253.112...
Connected to github.com.
Escape character is '^]'.
SSH-2.0-libssh-0.7.0

ssh keys are usually located in $HOME/.ssh/ (where $HOME is the home directory of the user that runs the Jenkins master) -- the folder /var/lib/jenkins/.ssh looks at least unusal.

The directory /etc/ssh contains system-wide ssh configuration data, it will always be read and is not intended for user-specific configuration items.

Upvotes: 1

Related Questions