I'm trying to access gitlab with my account in SSH with public key authentication. I have uploaded my public key and here is my SSH configuration:

content of /home/$my_user/.ssh/config
Host gitlab
User git
Port 22
Hostname gitlab.$my_domain
IdentityFile /home/$my_user/.ssh/id_rsa
IdentitiesOnly yes

Here is the command I tiped:

mkdir $my_project
cd $my_project
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin gitlab:$my_user/$my_project.git
git push -u origin master

Here is the sshd log file: auth.log

Here is the stack on client side: client stack

As I am authenticated, and my key correctly loaded from ~git/.ssh/authorized_keys, I presume the trouble comes from the client side. But I cannot determine where the issue comes from and neither how to fix it.

Many thanks for your help; Don't hesitate to ask for more details if you need to.

EDIT: here is the output of ssh -v git@gitlab

  • What is the output of "ssh -v git@gitlab" – deagh Apr 27 '14 at 14:43
  • Many thanks for your answer, I posted the pastbin link of the output of ssh -v git@gitlab as an edit of my post – philippe Apr 27 '14 at 15:14
  • Have you run rake gitlab:check as described at github.com/gitlabhq/gitlab-public-wiki/wiki/… and corrected any problems it finds? – sciurus Apr 27 '14 at 22:26
  • I think you should add the outputs of your commands here. The links no longer work. – Daniel Jun 7 '15 at 21:45

The gitlab shell, which is invoked by your SSH login, needs to make a call to the API of the gitlab web application to determine if you're authorized to push. However, it can't connect to it. Run the appropriate rake task for your version of gitlab to check the configuration of all the gitlab components and fix any errors it finds.

  • 1
    Thanks for your answer which resolves the issue I was having. Running the rake task according to my gitlab version (sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production) shows that there was a trouble with my host which is named differently from inside or outside my network. I remapped it to always point to my internal hostname (/etc/hosts) and it worked :) – philippe Apr 28 '14 at 15:28

A 'Connection Refused' message generally means that there is no process listening on the IP:Port combination you are trying to connect to.

  • Confirm the ports that you are using.
  • Use netstat to check that processes are listening on the relevant IP:ports.
  • Check that you are not blocking the ports at your firewall.
  • Thanks for your answer; however SSH port is open, its banner shows up and ssh-server fingerprints get displayed; sciurus advice helped me understand that the different names associated to the server (from inside or outside the network) was causing the trouble. I have launched sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production which showed the error. – philippe Apr 28 '14 at 15:25
  • 1
    @philippe I guess I was kinda right in that it wasn't listening on the IP:port you were connecting t ;) – user9517 Apr 28 '14 at 16:03
  • You were totally right, but I couldn't retrieve the answer from it, I was convinced the issue would come from a network trouble; It was indeed a network issue, but caused by a wrong configuration. – philippe Apr 29 '14 at 8:54

The problem is due to git/https buffer settings. In order to solve it

  git config http.postBuffer somehugenumber

And run the command again

  • Thanks for your help; I have tried launching git config http.postBuffer 524288000; with same result :/ – philippe Apr 27 '14 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.