contrib: remove 'mw-to-git'
[git] / Documentation / git-shell.txt
1 git-shell(1)
2 ============
3
4 NAME
5 ----
6 git-shell - Restricted login shell for Git-only SSH access
7
8
9 SYNOPSIS
10 --------
11 [verse]
12 'chsh' -s $(command -v git-shell) <user>
13 'git clone' <user>`@localhost:/path/to/repo.git`
14 'ssh' <user>`@localhost`
15
16 DESCRIPTION
17 -----------
18
19 This is a login shell for SSH accounts to provide restricted Git access.
20 It permits execution only of server-side Git commands implementing the
21 pull/push functionality, plus custom commands present in a subdirectory
22 named `git-shell-commands` in the user's home directory.
23
24 COMMANDS
25 --------
26
27 'git shell' accepts the following commands after the '-c' option:
28
29 'git receive-pack <argument>'::
30 'git upload-pack <argument>'::
31 'git upload-archive <argument>'::
32         Call the corresponding server-side command to support
33         the client's 'git push', 'git fetch', or 'git archive --remote'
34         request.
35
36 If a `~/git-shell-commands` directory is present, 'git shell' will
37 also handle other, custom commands by running
38 "`git-shell-commands/<command> <arguments>`" from the user's home
39 directory.
40
41 INTERACTIVE USE
42 ---------------
43
44 By default, the commands above can be executed only with the '-c'
45 option; the shell is not interactive.
46
47 If a `~/git-shell-commands` directory is present, 'git shell'
48 can also be run interactively (with no arguments).  If a `help`
49 command is present in the `git-shell-commands` directory, it is
50 run to provide the user with an overview of allowed actions.  Then a
51 "git> " prompt is presented at which one can enter any of the
52 commands from the `git-shell-commands` directory, or `exit` to close
53 the connection.
54
55 Generally this mode is used as an administrative interface to allow
56 users to list repositories they have access to, create, delete, or
57 rename repositories, or change repository descriptions and
58 permissions.
59
60 If a `no-interactive-login` command exists, then it is run and the
61 interactive shell is aborted.
62
63 EXAMPLE
64 -------
65
66 To disable interactive logins, displaying a greeting instead:
67
68 ----------------
69 $ chsh -s /usr/bin/git-shell
70 $ mkdir $HOME/git-shell-commands
71 $ cat >$HOME/git-shell-commands/no-interactive-login <<\EOF
72 #!/bin/sh
73 printf '%s\n' "Hi $USER! You've successfully authenticated, but I do not"
74 printf '%s\n' "provide interactive shell access."
75 exit 128
76 EOF
77 $ chmod +x $HOME/git-shell-commands/no-interactive-login
78 ----------------
79
80 SEE ALSO
81 --------
82 ssh(1),
83 linkgit:git-daemon[1],
84 contrib/git-shell-commands/README
85
86 GIT
87 ---
88 Part of the linkgit:git[1] suite