shell: Rewrite documentation and improve error message
Update the documentation of 'git shell' to mention the interactive mode and COMMAND_DIR. Also provide a hint when interactive mode is not available in the shell. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Reviewed-by: Greg Brockman <gdb@MIT.EDU> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Aug 24, 2010 at 11:06 UTC
70256a3a6780a9fd181edf0bf0e762eb56637c9c
2 files changed
+22
-13
Documentation/git-shell.txt
+17
-11
@@ -3,24 +3,30 @@ git-shell(1)
3
4
NAME
5
----
6
-git-shell - Restricted login shell for GIT-only SSH access
6
+git-shell - Restricted login shell for Git-only SSH access
7
8
9
SYNOPSIS
10
--------
11
-'$(git --exec-path)/git-shell' -c <command> <argument>
11
+'git shell' [-c <command> <argument>]
12
13
DESCRIPTION
14
-----------
15
-This is meant to be used as a login shell for SSH accounts you want
16
-to restrict to GIT pull/push access only. It permits execution only
17
-of server-side GIT commands implementing the pull/push functionality.
18
-The commands can be executed only by the '-c' option; the shell is not
19
-interactive.
20
-
21
-Currently, only four commands are permitted to be called, 'git-receive-pack'
22
-'git-upload-pack' and 'git-upload-archive' with a single required argument, or
23
-'cvs server' (to invoke 'git-cvsserver').
15
+
16
+A login shell for SSH accounts to provide restricted Git access. When
17
+'-c' is given, the program executes <command> non-interactively;
18
+<command> can be one of 'git receive-pack', 'git upload-pack', 'git
19
+upload-archive', 'cvs server', or a command in COMMAND_DIR. The shell
20
+is started in interactive mode when no arguments are given; in this
21
+case, COMMAND_DIR must exist, and any of the executables in it can be
22
+invoked.
23
+
24
+'cvs server' is a special command which executes git-cvsserver.
25
+
26
+COMMAND_DIR is the path "$HOME/git-shell-commands". The user must have
27
+read and execute permissions to the directory in order to execute the
28
+programs in it. The programs are executed with a cwd of $HOME, and
29
+<argument> is parsed as a command-line string.
30
31
Author
32
------
shell.c
+5
-2
@@ -149,8 +149,11 @@ int main(int argc, char **argv)
149
} else if (argc == 1) {
150
/* Allow the user to run an interactive shell */
151
cd_to_homedir();
152
- if (access(COMMAND_DIR, R_OK | X_OK) == -1)
153
- die("Sorry, the interactive git-shell is not enabled");
152
+ if (access(COMMAND_DIR, R_OK | X_OK) == -1) {
153
+ die("Interactive git shell is not enabled.\n"
154
+ "hint: ~/" COMMAND_DIR " should exist "
155
+ "and have read and execute access.");
156
+ }
157
run_shell();
158
exit(0);
159
} else if (argc != 3 || strcmp(argv[1], "-c")) {