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.
ssh-keygen
with filename johndoe.git commit -a -m "what i did"
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
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.