Gitlab: can't SSH from home (Windows)

1k views Asked by At

I can't get SSH to work for GitLab from my home PC.

To be clear: 1. SSH works fine for BitBucket on the same machine 2. SSH key has been added and is correct 3. I'm connected through a VPN (working)

I get the following output when I try to connect with -v -v -v parameters:

$ ssh git@[server] -v -v -v
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/[me]/.ssh/config
debug2: ssh_connect: needpriv 0
debug1: Connecting to [server] [ip] port 22.
debug1: connect to address [server] port 22: Attempt to connect timed ` out wssh: connect to host [server] port 22: Bad file number

Would this likely be a server configuration issue?

Edit:

I generated a new key and configured ssh to use it. Here's the output:

$ ssh -Tvv git@[server]
OpenSSH_6.6.1, OpenSSL 1.0.1i 6 Aug 2014
debug1: Reading configuration data /c/Users/[me].ssh/config
debug1: /c/Users/[me]/.ssh/config line 5: Applying options for [server]
debug2: ssh_connect: needpriv 0
debug1: Connecting to [server] [IP] port 22.
debug1: connect to address [IP] port 22: Attempt to connect timed out without establishing a connection
ssh: connect to host [server] port 22: Bad file number
1

There are 1 answers

2
VonC On

SSH works fine for BitBucket on the same machine SSH key has been added and is correct

I hope it isn't the same ssh key which has been added to GitLab, but a different public one (for a corresponding different private ssh key)

In that case, you would need an ~/.sssh/config referencing both public keys, as in "How to set up two SSH keys for two GitLab accounts and push/pull by using TortoiseGit?":

# my primary account for BitBucket
Host bitbucket
    User git
    HostName bitbucket.com
    PreferredAuthentications publickey
    IdentityFile C:/Users/{username}/.ssh/id_rsa1

# for GitLab server
Host gserver
    User git
    HostName {server}
    PreferredAuthentications publickey
    IdentityFile C:/Users/{username}/.ssh/id_rsa2

In the meantime, check the output of:

ssh -Tvv gserver

(with 'gserver' being the entry of the .ssh/config file, which references the right private ssh key, and the user 'git')