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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With