Search code examples
sshtimeoutrepositorygitlab

gitlab.com SSH connection timed out


i try to get Gitlab with SSH working, but it won't.

I have done following steps:

1 ) generate ssh-key

ssh-keygen -t rsa -C "[email protected]" -b 4096

2 ) named the key "id_rsa" in folder /Users/myUserName/.ssh/

3) copied the key via

pbcopy < ~/.ssh/id_rsa.pub

4) insert the key into gitlab

When i now try to clone a repository i receive the following error:

$ git clone [email protected]:myName/repositoryName/ repoName
Cloning into 'repoName'...
ssh: connect to host gitlab.com port 22: Operation timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

What is going wrong?


Solution

  • I found myself with the same problem.

    As Adrian Dymorz describe you can check if you have access to Gitlab through SSH with the following command:

    ssh [email protected]
    

    You should receive a response like this:

    ...
    Welcome to GitLab, <Gitlab ID Account>!
    Shared connection to altssh.gitlab.com closed.
    

    If not, then betarrabara should solve your issues BUT you should not provide your id_rsa but your id_rsa.pub instead:

    Host gitlab.com
    Hostname altssh.gitlab.com
    User git
    Port 443
    PreferredAuthentications publickey
    IdentityFile ~/.ssh/id_rsa.pub