Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 238
AnDoDri Avatar asked Jun 28 '18 09:06

AnDoDri


2 Answers

I tried the above method but remove the .pub in last line because it said not correct format. And it's worked.

Host gitlab.com
 Hostname altssh.gitlab.com
 User git
 Port 443
 PreferredAuthentications publickey
 IdentityFile ~/.ssh/id_rsa
like image 135
Quy Nguyen Avatar answered Sep 18 '22 14:09

Quy Nguyen


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
like image 33
Benoit Besnier Avatar answered Sep 17 '22 14:09

Benoit Besnier