1GIT-SHELL(1)                      Git Manual                      GIT-SHELL(1)
2
3
4

NAME

6       git-shell - Restricted login shell for Git-only SSH access
7

SYNOPSIS

9       chsh -s $(command -v git-shell) <user>
10       git clone <user>@localhost:/path/to/repo.git
11       ssh <user>@localhost
12
13

DESCRIPTION

15       This is a login shell for SSH accounts to provide restricted Git
16       access. It permits execution only of server-side Git commands
17       implementing the pull/push functionality, plus custom commands present
18       in a subdirectory named git-shell-commands in the user’s home
19       directory.
20

COMMANDS

22       git shell accepts the following commands after the -c option:
23
24       git receive-pack <argument>, git upload-pack <argument>, git
25       upload-archive <argument>
26           Call the corresponding server-side command to support the client’s
27           git push, git fetch, or git archive --remote request.
28
29       cvs server
30           Imitate a CVS server. See git-cvsserver(1).
31
32       If a ~/git-shell-commands directory is present, git shell will also
33       handle other, custom commands by running "git-shell-commands/<command>
34       <arguments>" from the user’s home directory.
35

INTERACTIVE USE

37       By default, the commands above can be executed only with the -c option;
38       the shell is not interactive.
39
40       If a ~/git-shell-commands directory is present, git shell can also be
41       run interactively (with no arguments). If a help command is present in
42       the git-shell-commands directory, it is run to provide the user with an
43       overview of allowed actions. Then a "git> " prompt is presented at
44       which one can enter any of the commands from the git-shell-commands
45       directory, or exit to close the connection.
46
47       Generally this mode is used as an administrative interface to allow
48       users to list repositories they have access to, create, delete, or
49       rename repositories, or change repository descriptions and permissions.
50
51       If a no-interactive-login command exists, then it is run and the
52       interactive shell is aborted.
53

EXAMPLE

55       To disable interactive logins, displaying a greeting instead:
56
57       +
58
59           $ chsh -s /usr/bin/git-shell
60           $ mkdir $HOME/git-shell-commands
61           $ cat >$HOME/git-shell-commands/no-interactive-login <<\EOF
62           #!/bin/sh
63           printf '%s\n' "Hi $USER! You've successfully authenticated, but I do not"
64           printf '%s\n' "provide interactive shell access."
65           exit 128
66           EOF
67           $ chmod +x $HOME/git-shell-commands/no-interactive-login
68
69

SEE ALSO

71       ssh(1), git-daemon(1), contrib/git-shell-commands/README
72

GIT

74       Part of the git(1) suite
75
76
77
78Git 1.8.3.1                       11/19/2018                      GIT-SHELL(1)
Impressum