gitosis asking for password

andho picture andho · Feb 3, 2011 · Viewed 10.6k times · Source

I have setup a gitosis server following instructions from here. It works fine for the initial user but I have recently added a new user. Here are the steps I took.

  • Created an rsa keypair using ssh-keygen with filename johndoe.
  • Then copied it to the keydir in gitosis admin repo.
  • Edited the gitosis config file and added user johndoe to the list of members
  • Commited the changes using git commit -a -m "what i did"
  • Pushed the changes to the server

After that I tried to check out with the new keyfile. It asks for the passphrase and when I enter it correctly, it the asks for the password for user git!!! There is not password for user git.

Now I have turned off PasswordAuthentication in sshd_config and now it says 'Permission denied (publickey). I have checked the git user's authorized_keys file and only one key is authorized inside it, i.e. the initial key for the gitosis admin.

I have also double checked the permissions on the ./gitosis-admin.git/hooks/post-update hook and it has 755

Answer

ebneter picture ebneter · Feb 3, 2011

Gitosis is kind of stupid — is the filename you used for the keyfile literally "johndoe"? If so, change that:

git mv keydir/johndoe keydir/johndoe.pub
git commit -m "changed key name"
git push

and try again.

Also, as Arlen Cuss points out, make sure it actually is the public key, not the private key.