Skip to content
  • Jonathan Nieder's avatar
    shell: new no-interactive-login command to print a custom message · 35297089
    Jonathan Nieder authored and Junio C Hamano's avatar Junio C Hamano committed
    
    
    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: default avatarEthan Reesor <firelizzard@gmail.com>
    Signed-off-by: default avatarJonathan Nieder <jrnieder@gmail.com>
    Improved-by: default avatarJeff King <peff@peff.net>
    Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    35297089