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="/path/to/git-server KEY=user1" ssh-ed25519 AAAA_OAX+blah_pub__ user1@workstation

 -- OR --

Advanced Method:
Set SHELL=/path/to/git-server (in /etc/passwd) and
Add /path/to/git-server to /etc/shells and
Set "PermitUserEnvironment yes" (in /etc/ssh/sshd_config)
Then use the following format in ~/.ssh/authorized_keys:
environment="KEY=user1" ssh-ed25519 AAAA_OAX+blah_pub__ user1@workstation

ENV

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

KEY

KEY has a special meaning to define a word for the associated user and KEY should be unique for each public key and this can be used for ACL rules.

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 repo on the git host:

git init --bare project

Then add hooks/run-git-hooks to override the default behavior:

vi project/hooks/run-git-hooks
chmod 755 project/hooks/run-git-hooks

If hooks/run-git-hooks exists from within the repository being targeted, then this will run with the correct GIT_DIR and any other ENV settings defined in authorized_keys. If it doesn't exist, then it will look for a way to use these git-server hooks with this project.

SEE ALSO

Similar functionality to the following:

gitlab-shell, gitolite, git-shell

AUTHOR

Rob Brown <bbb@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2015-2025 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.