Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GitLab Error: Connection Refused

Tags:

git

gitlab

I have a cloud server from Digital Ocean that is hosting GitLab.

Whenever I try to create a repository and push it to GitLab, I am getting the following error :

ssh: connect to host localhost port 22: Connection refused
fatal: The remote end hung up unexpectedly

I am fairly new to git so I am confused why I keep getting this error. I also have generated and added my SSH key to GitLab. Here are the steps I take to create the repository (per GitLab's instruction):

mkdir test
cd test
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin git@idAddress
git push -u origin master

Any suggestions?

like image 644
JT9 Avatar asked Dec 13 '13 03:12

JT9


2 Answers

You can test your SSH key authentication with:

$ ssh -T [email protected]

Check that your public key is saved in your Gitlab profile, and make sure no newlines are present in the string. Then check that git is using your correct private key if you have more than one.

Also consider that Gitlab may require the repository to exist; the push won't create a new repo.

like image 160
Nick Avatar answered Oct 03 '22 14:10

Nick


localhost port 22: Connection refused

Means Git tried to connect to SSH (port 22) to your local host (localhost), and nothing was listening on that port — hence Connection refused.

You mention ipAddress in your setup, is it 127.0.0.1?

like image 31
kostix Avatar answered Oct 03 '22 14:10

kostix