GitLab requires git@localhost password to push to a repo

Viewed 30372

I'm trying to get GitLab up and running on my server. I followed the installation instructions at the gitlab github page and everything went well.

The issue is, when I create a repo and try to

sudo git push -u origin master

I am prompted for 'git@localhost's password: '

The git user doesn't have a password, so this is a problem.

Other people who have run into this problem suggested adding git to AllowedUsers in my sshd conf but I don't have an AllowedUsers field in there, so that doesn't seem to be an issue.

I'm still pretty new to ssh stuff so I believe its some sort of ssh key issue, though I tried to add all relevant ssh keys to /home/git/.ssh/authorized_keys and verified that there are no line breaks in the file.

Just FYI, my install completely passes the test provided in the gitlab wiki:

sudo -u gitlab bundle exec rake gitlab:app:status RAILS_ENV=production

Any suggestions much appreciated!

EDIT

So, I finally got around this by just committing to a repo from a different machine. As it was, I was SSHed into the same machine that gitlab was running on. As soon as I tried to commit from a machine other than the host, it worked great. So, that may be a solution for some people (it is for us, since we develop on seperate machines than our servers).

This is still an open-ended issue for anyone trying to host and develop on the same machine who has run into this.

15 Answers

I had the a similar problem: Gitlab server is inside a docker container and every time when I tried to push changes, I had: git@localhost's password:

the root cause was using "localhost" as a name. Right way is to check out the IP of the GitLab's container by: $ docker inspect <container_id>

find the row: "IPAddress": "172.17.0.2",

test it by: ssh -T git@172.17.0.2 the answer should be like this. "Welcome to GitLab, @user_name!"

now it's necessary to fix repository's URL: $ git remote set-url origin git@172.17.0.2:user_name/repo-name.git

after that the push command should work properly.

Related