summaryrefslogtreecommitdiff
path: root/Documentation/git-shell.txt
diff options
context:
space:
mode:
authorJonathan Nieder <jrnieder@gmail.com>2013-03-09 22:00:11 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-03-10 07:21:35 (GMT)
commit35297089e550c30e6d0f6db2adca5d44d254a7ed (patch)
tree95c5341a16019c6d31e02291978b86fd6f936966 /Documentation/git-shell.txt
parentcdd9b3c96cc4a01bbc5f2f778e75028ea67a5f91 (diff)
downloadgit-35297089e550c30e6d0f6db2adca5d44d254a7ed.zip
git-35297089e550c30e6d0f6db2adca5d44d254a7ed.tar.gz
git-35297089e550c30e6d0f6db2adca5d44d254a7ed.tar.bz2
shell: new no-interactive-login command to print a custom message
If I disable git-shell's interactive mode by removing the ~/git-shell-commands directory, attempts to ssh in to the service produce a message intended for the administrator: $ ssh git@myserver fatal: Interactive git shell is not enabled. hint: ~/git-shell-commands should exist and have read and execute access. $ That is helpful for the new admin who is wondering "What? Why isn't the git-shell I just set up working?", but once the site setup is complete, it would be better to give the user a friendly hint that she is on the right track, like GitHub does. Hi <username>! You've successfully authenticated, but GitHub does not provide shell access. An appropriate greeting might even include more complex dynamic information, like gitolite's list of repositories the user has access to. Add support for a ~/git-shell-commands/no-interactive-login command that generates an arbitrary greeting. When the user tries to log in: * If the file ~/git-shell-commands/no-interactive-login exists, run no-interactive-login to let the server say what it likes, then hang up. * Otherwise, if ~/git-shell-commands/ is present, start an interactive read-eval-print loop. * Otherwise, print the usual configuration hint and hang up. Reported-by: Ethan Reesor <firelizzard@gmail.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Improved-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/git-shell.txt')
-rw-r--r--Documentation/git-shell.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/Documentation/git-shell.txt b/Documentation/git-shell.txt
index 544b21a..c35051b 100644
--- a/Documentation/git-shell.txt
+++ b/Documentation/git-shell.txt
@@ -59,6 +59,26 @@ users to list repositories they have access to, create, delete, or
rename repositories, or change repository descriptions and
permissions.
+If a `no-interactive-login` command exists, then it is run and the
+interactive shell is aborted.
+
+EXAMPLE
+-------
+
+To disable interactive logins, displaying a greeting instead:
++
+----------------
+$ chsh -s /usr/bin/git-shell
+$ mkdir $HOME/git-shell-commands
+$ cat >$HOME/git-shell-commands/no-interactive-login <<\EOF
+#!/bin/sh
+printf '%s\n' "Hi $USER! You've successfully authenticated, but I do not"
+printf '%s\n' "provide interactive shell access."
+exit 128
+EOF
+$ chmod +x $HOME/git-shell-commands/no-interactive-login
+----------------
+
SEE ALSO
--------
ssh(1),