Gitolite prompts for password only on central serv

2019-02-20 13:23发布

问题:

I am running gitlab which uses gitolite on a central repository Ubuntu machine and have several users that connect to this machine after adding their public SSH keys via Gitlab's web interface. The different users on their own machines can successfully push and pull from the central repository machine just fine. On the machine itself, I cannot have my user push or pull to the central repository. It always asks for git's password! How can I fix this?

On a remote machine with SSH key registered I get:

myusername@ubuntu:~$ ssh -T git@111.222.333.444
hello my_username_gmail_com_1348772800, this is gitolite v2.2-11-g8c4d1aa-dt running on git 1.7.0.4
the gitolite config gives you the following access:
     R   W  repo1
     R   W  repo2
    @R_ @W_ testing
     R   W  repo3

It only fails on the server itself, where ( even though I registered the SSH Keys ) I am always prompted for a password:

serverusername@server:~$ ssh -T git@111.222.333.444
git@111.222.333.444's password: 

Here is the output of the ssh -Tvvv debug prints: http://pastebin.com/zrNzvzRE

回答1:

I appreciate VonC's attempt at helping me. However the fix was just to reboot the machine and add several new regenerated keys. I am positive that I copied them correctly the first few times but eventually recreating the key several times worked. Since it worked I called it done. I understand this isn't a very satisfying answer...



回答2:

Check what ssh -Tvvv git@111.222.333.444 returns, in combination with a sshd -d (a debug session of your ssh daemon)

You should see it somehow doesn't find git.pub and git (public and private keys named after the user name) in your ~git/.ssh.
Those public and private keys can also be stored with their default name (id_rsa and id_rsa.pub) on your server (~git/.ssh).