Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git/gitosis: How to check validity of user name and email?

Tags:

git

gitosis

I have installed git and gitosis and I need to add a check that the user name is valid when something is pushed into the repository.

I reckon the pre-receive hook is the correct hook to place this, but I'm unable to find the real user name and email address which gitosis enters into the repository (the ones set by git config user.name and git config user.email) from environment variables. LOGNAME and USER are both 'git'. How does gitosis detect this info and can I find it in the pre-receive hook as well?

like image 421
Makis Avatar asked May 05 '09 14:05

Makis


1 Answers

You can check <gitosis-path>/.ssh/authorized_keys and see:

command="gitosis-serve name@server",...

Read man for sshd and found: after command="command" you can add environment="NAME=value" option to set the desired user names for you public ssh keys. And no Gitosis/Serve.py editing required.

Environment processing is disabled by default and is controlled via the PermitUserEnvironment option:

sudo echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
like image 132
egor7 Avatar answered Oct 01 '22 03:10

egor7