Refer to Git on the Server - The Protocols for a detailed description along with pros and cons.
Step by Step Guide on Setting Up git Server describes setting up an unsecured server on Arch.
By default, the git user is expired ("Your account has expired; please contact your system administrator"). Use chage to remove the expiration condition, e.g. as follows:
chage -E -1 git
You only need to set up an SSH server.
You are able to secure the SSH user account even more allowing only push and pull commands on this user account. This is done by replacing the default login shell by git-shell. Described in Setting Up the Server.
- Change the home directory: In order for ssh to be able to read
/srv/git/.ssh/authorized_keys, the home directory for git in
/etc/passwdneeds to be changed from
- Change the base path when home directory is corrected: In order for git to serve the repositories, the
git-daemon\@.serviceneed to be changed to
/srv/gitif the repositories are served from git's home directory.
Theis a CGI program, allowing efficient cloning, pulling and pushing over HTTP(S).
The setup for this is rather simple as all you need to have installed is the Apache HTTP Server, with
mod_env enabled) and of course, .
Once you have your basic setup running, add the following to your Apache configuration file, which is usually located at:
<Directory "/usr/lib/git-core"> Require all granted </Directory> SetEnv GIT_PROJECT_ROOT /srv/git SetEnv GIT_HTTP_EXPORT_ALL ScriptAlias /git/ /usr/lib/git-core/git-http-backend/
This assumes your Git repositories are located at
/srv/git and that you want to access them via something like:
For more detailed documentation, visit the following links:
The Git protocol is not encrypted or authenticated, and only allows read access.
The Git daemon (started with
The service uses the
--base-path parameters to serve all repositories placed in
For fine-grained access control, the following solutions are available:
- Gitolite — An access control layer on top of Git, written in Perl.
- Gitosis — Software for hosting Git repositories, written in Python.
Note that if you are willing to create user accounts for all of the people that should have access to the repositories and do not need access control at the level of git objects (like branches), you can also use standard file permissions for access control.
Simple web applications
- Gitweb — the default web interface that comes with Git
- cgit — A web interface for git written in plain C.
Advanced web applications
- Gitea — Painless self-hosted Git service. Community managed fork of Gogs.
- GitLab — Project management and code hosting application, written in Ruby.
- Gogs — Self Hosted Git Service, written in Go.
- https://gogs.io || AUR