Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to install git server. When I set default shell for my git user to /usr/bin/git-shell I get an error upon login as git.

fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.

Ssh key based access work, permissions are set correctly.

Google search does not show anything regarding this error.

I also used this method in past installations and no such error was shown. Also I looked at working server if it has some extra files or config but no such thing.

System spec:

  • Gentoo linux (latest)
  • Git 1.7.5.3

/etc/passwd line:

git:x:1002:1004::/home/git:/usr/bin/git-shell
share|improve this question

3 Answers 3

I found this after doing locate git-shell-commands

cat /usr/share/doc/git-1.7.4.4/contrib/git-shell-commands/README

Sample programs callable through git-shell. Place a directory named 'git-shell-commands' in the home directory of a user whose shell is git-shell. Then anyone logging in as that user will be able to run executables in the 'git-shell-commands' directory.

Provided commands:

help: Prints out the names of available commands. When run interactively, git-shell will automatically run 'help' on startup, provided it exists.

list: Displays any bare repository whose name ends with ".git" under user's home directory. No other git repositories are visible, although they might be clonable through git-shell. 'list' is designed to minimize the number of calls to git that must be made in finding available repositories; if your setup has additional repositories that should be user-discoverable, you may wish to modify 'list' accordingly.

So I

[root@svn ~]# cp /usr/share/doc/git-1.7.4.4/contrib/git-shell-commands /home/git -R
[root@svn ~]# chown git:developers /home/git/git-shell-commands/ -R
[root@svn ~]# chmod +x /home/git/git-shell-commands/help
[root@svn ~]# chmod +x /home/git/git-shell-commands/list
[root@svn ~]# exit
[me@svn ~]$ su git
Password: 
Run 'help' for help, or 'exit' to leave.  Available commands:
list
git> help
Run 'help' for help, or 'exit' to leave.  Available commands:
list
git> list
git> exit

Now I don't see what good help and list are, but the login worked. :)

share|improve this answer
    
there would have to be bare repositories in the users' home directories for "list" to do anything (as per the readme) –  michael_n Sep 4 '12 at 2:36

i just had to do # mkdir ~git/git-shell-commands then su git worked for git 1.8.1.5-r1

share|improve this answer
1  
Worked for me as well –  maurycy Jun 9 at 9:39

If you look at the code which triggers that error message (which seems to have been different in older versions of Git):

if (access(COMMAND_DIR, R_OK | X_OK) == -1) {
  die("Interactive git shell is not enabled.\n"
     "hint: ~/" COMMAND_DIR " should exist "
     "and have read and execute access."); 

this should be a right issue on the git-shell directory.

The user must have read and execute permissions to the directory in order to execute the programs in it.

share|improve this answer
    
... just as it says in the error message, in fact. (-: –  JdeBP Jul 1 '11 at 12:52
    
@JdeBP: and I suppose you do have ~/git-shell-commands with the right permissions? –  VonC Jul 1 '11 at 12:56
    
You're talking to the wrong person. –  JdeBP Jul 1 '11 at 13:13
    
@JdeBP: sorry ;) @Peter and I suppose you do have ~/git-shell-commands with the right permissions? –  VonC Jul 1 '11 at 13:20
    
Where can you find the git-shell-commands? –  user112744 Jun 12 '12 at 18:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.