GitLab requires git@localhost password to push to a repo

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!


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.


Keys store on both gitlab DB and gitolite side. You should use the factory build gitolite-admin.git folder, don't use your backup! And rebuild the Keys for gitolite later with the update keys command. (update those keys already saved inside the gitlab db to gitolite)

sudo -u gitlab -H bundle exec rake gitlab:gitolite:update_keys RAILS_ENV=production

Most likely it's because there is something issue about the gitolite keys not save properly. Those keys (for login) are actually keep separately by gitlab & gitolite. For pull/push is actually using the keys saved inside gitolite. (git/repositories/gitolite-admin.git/index, git/.gitolite/keydir, git/.ssh/authorized_keys)

gitlab normally should help on saving those imported keys on web to the gitolite files. However, for some reasons it failed. As the keys are not saved properly inside gitolite, the client/server fail to use the keys and fallback to password.

You have to check and fix those keys saved inside gitolite to correct the problems.

check out for more!topic/gitlabhq/X0z_9l7L7A8

GitLab requires git@localhost password to push to a repo, TL;DR. Keys store on both gitlab DB and gitolite side. You should use the factory build gitolite-admin.git folder, don't use your backup! The issue is, when I create a repo and try to 'git push -u origin master' I am prompted for 'git@localhost's password: ' Some people have 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.

If the installation went well, that means your gitlab is able to clone the gitolite-admin repo without issue. But you say it passes the status check, which means you are using, for ssh connection, an account named 'gitlab'.

That also means that any client will have to ssh with that same account 'gitlab', not 'git'. So if your ssh key has been added through the gitlab interface, then you can git clone/git push to a remote name origin which would have the address 'gitlab@server'

To debug some more, check out some other tips mentioned in "Setup Git Remote SSH (git-upload-pack / git-receive-pack)":

If you cannot push locally (on the server itself, that is on 'localhost'), try at least a:

ssh -vvvT gitlab@localhost

It shouldn't require any password, since /home/gitlab/.ssh/id_rsa and /home/gitlab/.ssh/ both exist.

GitLab requires git@localhost password to push to a repo, The proper way to access a repository managed by gitlab is to add a public key. First, you need to create a keypair: (these are the commands� Enter the following command. git push -u origin master. After you press Enter or Return, you'll be asked to enter your GitLab username and password. Since you've created a private repository, this step makes sure that only the project owner can make changes to the repository.

I received the same password prompt. My issue was that I had restricted ssh usage to only a couple of users. I added the git user to the AllowUsers list sshd_config, and everything worked great.

Gitlab asks for git user password when pushing a repo. � Issue #34 , Now its working fine on localhost, but I cannot make it work on remote host. When I clone/push repository, it raise this error: jiris-imac:connect� I don’t know if this is the right place to ask this question but I tried everything looked through many forums and didn’t find my answer. I’m running GitLab on a virtual machine that has CentOS 7 on it and I set up the SSH keys but everytime i try to connect my repo with GitLab it asks for a password, I don’t know what more info to provide you with since im a newbie.

This started happening to me quite a lot lately - for work projects git would ask me my email and password. When entered it continues ok but it's annoying.

I can fix this for any given application that I have access to with:

git config remote.origin.url


git config remote.origin.url

GitLab requires git@localhost password to push to a repo, 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,� A Git remote is kind of like a backup that is stored on someone else’s computer. To create a Git remote, you can use one of the popular services like Github, Bitbucket, and Gitlab. Create a remote repository, then link your local repository to the remote repository. When you link them up, you can push to the remote repository. Thanks for reading.

Make sure your gitlab profile has your public ssh key. Sign into gitlab, go to your profile and select the button "Add Public Key". Copy and paste you "keyfile".pub contents in the in the Key box. There were some versions of gitlab that had a bug that when you did add your public key, it did not update the authorized_keys file. Verify (but do not manually add) that your public key is in the authorized_keys file after you add it to your profile. If this is not the issue, then perhaps one of the earlier answers will help.

Visibility and access controls, Branch protection specifies which roles can push to branches and which roles can To protect other branches, you must configure branch protection in repository. on the user's part is required, e.g. adding an SSH key, or setting a password. If you download it, you cannot sync it with the remote repository on GitLab. On the other hand, by cloning a repository, you’ll download a copy of its files to your local computer, but preserve the Git connection with the remote repository, so that you can work on the its files on your computer and then upload the changes to GitLab. Pull and push

Be aware that the user who performs the ‘git push‘ must have access rights to the GitLab project. On a public repository, any user can perform a GitLab git clone. However, a GitLab push to origin requires user authentication, and if there is a GitLab branch permission, the user might also have to be in the developer or maintainer role.

Push to create a new project. Create a project. Most work in GitLab is done within a Project. Files and code are saved in projects, and most features are used within the scope of projects. Create a project in GitLab. To create a project in GitLab: In your dashboard, click the green New project button or use the plus icon in the navigation bar.

Issue the git clone command and specify the remote repo URL; Navigate into the directory created by the Ubuntu git clone; Perform basic Git commands such a push, branch, reflog and commt; How to Ubuntu git clone GitLab repos. The commands used in the Ubuntu git clone example where the target was a GitLab project are as follows:

  • new questions is
  • You should not use sudo with git push
  • Hi VonC, thanks for your help here. Just to verify, I am SSHed into the server machine under an account other than gitlab (the username is devin). ssh -vvvT gitlab@localhost does require a password, unfortunately. I haven't tried adding a key through the interface, as I haven't noticed an option to do that on gitlab. Let me know if you have any further suggestions. Thanks!
  • @DevinR if you try ssh without having added yuor public key first, it is normal that ssh asks for a password: it looks for your pub key in ~gitlab/.ssh/authorized_keys and doesn't find it. You need to generate a public/private key (as in and copy the public key in your gitlab account page.
  • I have now generated a user on gitlab and added my ssh key there. I also added the key to /home/gitlab/.ssh/authorized_keys and /home/git/.ssh/authorized_keys. Unfortunately I'm still having the same problem. Thanks again for your help.
  • @DevinR you shouldn't need to add anything to the gitlab authorized_keys file: that is the job of gitolite, called by gitlab when you added your public key through the interface. One thig that got me was the lack of a ~gitlab/.gitconfig file, that is a git global config for gitlab. Try, as gitlab, on the server, to type: git config --global gitlab and git config (the actual email address isn't important): that will avoid gitolite to barf at the lack of identification (no username, no email) when doing its operation: then try again to add a new key.
  • Nice, with the verbosity flags (-vvv) I was able to see that the ssh programs didn't have read-access to the private key file .. w/ msg: could not open key file '/home/XxX/.ssh/id_rsa': Permission denied
  • "give your server a power cycle" seems excessive - just reboot sshd.
  • This looked promising but still asking for password with the server address now