Although Git is a distributed version management system, for team project development, it is common to create a git server on a separate server. Similar to Svn,git server, there are several ways of configuring it. For more information, refer to Git's documentation http://git-scm.com/book/en/v2. Here, the main is from the above document to pick out a part, explain the usefulness of Git-shell.
If you are using SSH to access:
$ git clone git@10.3.0.99:project.git
This means that visitors have permissions to ssh to the server:
$ ssh git@10.3.0.99
For security reasons, we'd better limit the user to only Git push/pull, but not login. This can be done using Git-shell.
Check out the location of the Git-shell:
$ which Git-shell
/usr/bin/git-shell
Add the Git-shell path to the/etc/shells file, and then modify the git user's shell:
$ sudo chsh git
Set to/usr/bin/git-shell. This way, if you use SSH to log in again, you will get an error:
$ ssh git@10.3.0.99
git@10.3.0.99 ' s Password:
Welcome to Ubuntu 14.04.1 LTS (gnu/linux 3.13.0-35-generic x86_64)
* documentation:https://help.ubuntu.com/
Fatal:interactive git shell is not enabled.
Hint: ~/git-shell-commands should exist and have read and execute access.
Connection to 10.3.0.99 closed.