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

/etc/passwd line:

  • git-shell is a restricted shell to be used for push/pull functionality only (i.e. git push, git fetch and git pull). It's not meant to be interactive, so you should not login in an interactive shell. You can make it somewhat interactive by adding a git-shell-commands directory in the user's home and symlinking some binaries inside. But it's very limited (there's no binary for cd, for example), so a better alternative is to login as root or a sudoable user and do sudo -u git -s to get a full bash shell under the git user.
    – ADTC
    Jul 23, 2016 at 3:06

5 Answers 5


I found this after running locate git-shell-commands

cat /usr/share/doc/git-

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 ran the following commands as root:

cp /usr/share/doc/git- /home/git -R
chown git:developers /home/git/git-shell-commands/ -R
chmod +x /home/git/git-shell-commands/help
chmod +x /home/git/git-shell-commands/list

I was then able to run the following as the git user:

[me@svn ~]$ su git
Run 'help' for help, or 'exit' to leave.  Available commands:
git> help
Run 'help' for help, or 'exit' to leave.  Available commands:
git> list
git> exit

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

  • 1
    there would have to be bare repositories in the users' home directories for "list" to do anything (as per the readme)
    – michael
    Sep 4, 2012 at 2:36

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

  • 2
    Yeah, it works. Now you're in the git shell. Then what? It's completely useless for interaction unless you symlink some binaries inside git-shell-commands folder. I think it's more useful to skip all that and do sudo -u git -s so that you get a full bash shell with access to all binaries. You also stay in the current directory.
    – ADTC
    Jul 23, 2016 at 3:00

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.

  • ... just as it says in the error message, in fact. (-:
    – JdeBP
    Jul 1, 2011 at 12:52
  • @JdeBP: sorry ;) @Peter and I suppose you do have ~/git-shell-commands with the right permissions?
    – VonC
    Jul 1, 2011 at 13:20

I'm late to the party, but as stated in the git docs, all you have to do is run the following command on the remote host:

chsh -s $(command -v git-shell) <user>

Worked for me.


Apply these two commands it will resolve this issue:

To enable git-shell for your_git_user:

usermod -s /usr/bin/git-shell your_git_user

To change owner of your_git_user directory recursively:

chown -R your_git_user:your_users_group /home/your_git_user

You may add git shell commands using below command:

cp /usr/share/doc/git- /home/your_git_user/git-shell-commands -R

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .