I've set up gitosis and able to pull/push through ssh. Gitosis is installed on Debian Lenny server, I'm using git from windows machine (msysgit). The strange thing, if I enable loglevel = DEBUG in gitosis.conf, I see something like this when doing any actions with gitosis server:

D:\Kaze\source\test-project>git pull origin master
DEBUG:gitosis.serve.main:Got command "git-upload-pack 'test_project.git'"
DEBUG:gitosis.access.haveAccess:Access check for 'kurokikaze@example.com' as 'writable' on 'test_project.git'...
DEBUG:gitosis.access.haveAccess:Stripping .git suffix from 'test_project.git', new value 'test_project'
DEBUG:gitosis.group.getMembership:found 'kurokikaze@example.com' in 'test'
DEBUG:gitosis.access.haveAccess:Access ok for 'kurokikaze@example.com' as 'writable' on 'test_project'
DEBUG:gitosis.access.haveAccess:Using prefix 'repositories' for 'test_project'
DEBUG:gitosis.serve.main:Serving git-upload-pack 'repositories/test_project.git'

 * branch            master     -> FETCH_HEAD
Already up-to-date.

Question is: why am I kurokikaze@example.com? This email is in global user.email config variable, too.

Yesterday, when the gitosis was installed, it seen me as kaze@KAZE, this is the name under which I was added to gitosis-admin group (and it worked). But today git (or gitosis) started to see me as kurokikaze@example.com. This is true for all repositories I push or clone. I had to add this address to gitosis.conf directly on server to be able to edit configs again (it worked). There are 2 public keys in keydir: kurokikaze@example.com.pub and kaze@KAZE.pub, their content is identical and they have kaze@KAZE at end. Origin URL looks like git@lennyserver:test_project.

Now, the question is - why Git (or gitosis) suddenly decided to call me by email instead of name@machinename? I've changed a couple things trying to set up Gitosis (updated git on server to 1.6.0 for example), but maybe I broke something in my local git installation?

  • Did you by any chance push to the repo then afterwards in msysgit enter your username and email address? – seanl Jun 17 '10 at 12:30
  • Nope, AFAIR. It works this way even if I clone repo to a new folder. – Kuroki Kaze Jun 17 '10 at 13:09

From Gitosis' point of view, your name is just the name, in keydir, of the public key that you authenticated with. No configuration on your local machine matters, except as it affects what public key you use, and the string at the end of the key doesn't matter -- just the filename.

You've given your public key two names, so when you authenticate with that key it is undefined which one of them it finds when it looks for a name for that key. When you changed some other things in Gitosis, presumably it happened to change the arbitrary choice of which name it found.

(Specifically, I believe Gitosis generates its own authorized_keys to contain all the keys in keydir, one per line, with options to tell sshd to only let the user run Gitosis, only in a controlled manner, and telling Gitosis the name of the key. If multiple lines have the same key, I'm not sure which one sshd ends up using -- maybe the first, maybe the last, maybe it's arbitrary. The order in which Gitosis writes them may also be arbitrary. But really the details of how the arbitrary choice happens are beside the point, because nobody guarantees they won't change in the next update to sshd or gitosis.)

You should pick which name you want to use to refer to yourself in the Gitosis config, and keep in keydir only the copy of your key under that name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.