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 '[email protected]' 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 '[email protected]' in 'test'
DEBUG:gitosis.access.haveAccess:Access ok for '[email protected]' 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'
From 192.168.175.128:test_project
* branch master -> FETCH_HEAD
Already up-to-date.
Question is: why am I [email protected]? 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 [email protected]. 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
: [email protected]
and [email protected]
, 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?
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 inkeydir
, one per line, with options to tellsshd
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 onesshd
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 tosshd
orgitosis
.)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.