NAME

git-server - Secure Git Server with more granular hooks capabilities than default git.

SYNOPSIS

Standard Method:
With SHELL=/bin/bash, use the following format in ~/.ssh/authorized_keys:
command="git-server KEY=USER1" ssh-rsa AAAA___blah_pub__ user1@workstation

 -- OR --

Advanced Method:
Set SHELL=/usr/bin/git-server (in etc/passwd) and
Set "PermitUserEnvironment yes" (in etc/ssh/sshd_config)
Then use the following format in ~/.ssh/authorized_keys:
environment="KEY=USER1" ssh-rsa AAAA___blah_pub__ user1@workstation

ENV

You can set as many %ENV variables as you want within the authorized_keys configuration.

INSTALL

This can be used with any existing git repositories or as a drop-in replacement for git-shell or you can create a fresh git repo:

git init project

Then add whatever hooks you want:

vi project/.git/hooks/pre-read

Each hook can read the ENV settings defined in authorized_keys.

See contrib/* for some working "hooks" examples.

HOOKS

All the normal git hooks will continue to work, plus the following:

hooks/pre-read

Executed before any repository read operation, such as "git clone" or "git pull". If the pre-read exit status is non-zero, then the read operation will be aborted.

hooks/post-read

Executed after the git operation completes even if it was successful. There will be one argument "exit=$EXIT" passed to post-read, which is the exit status of the git operation. The post-read hook can parse this parameter if it needs to determine if the git operation was successful or not.

hooks/pre-write

Executed before any repository modification attempt, such as "git push". Unlike the hooks/update hook, this hooks/pre-write will always be triggered for write operations, even if there are no actual changes that need to be made.

hooks/post-write

Same as hooks/post-read except for write operations.

SEE ALSO

Similar functionality to the following:

gitlab-shell, gitolite, git-shell

AUTHOR

Rob Brown <bbb@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2015 by Rob Brown <bbb@cpan.org>

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.