I tried setting up git-shell on our CentOS (6.4) system (after getting this working correctly on Ubuntu 13.10, maybe cross platform hot mess?)

my /etc/passwd shows

git:x:500:500:Web Archive VCS:/home/git:/usr/bin/git-shell

and my shell commands are in /home/git/git-shell-commands

[root@domain git]# cd /home/git/git-shell-commands/ && tree
├── addkey
├── create
├── drop
├── help
└── list

But ssh'ing in is still giving me

Last login: Fri Nov 15 12:14:49 2013 from localhost
fatal: What do you think I am? A shell?
Connection to localhost closed.

I am working off of this resource

Hosting an admin-friendly git server with git-shell

There was some confusion that this was licensed GIT commands (push/pull etc) but this is a restricted shell with pre set commands! Please anyone reading this make note ;)

Installer script if you want to see steps


I still have not been able to resolve this over the weekend, I HAVE added

# add to shells
echo '/usr/bin/git-shell' >> /etc/shells

# Prevent full login for security reasons
chsh -s /usr/bin/git-shell git

And have double checked that GIT Shell actually exists in /usr/bin

[root@domain bin]# ll /usr/bin | grep git
-rwxr-xr-x. 105 root root    1138056 Mar  4  2013 git
-rwxr-xr-x.   1 root root    1138056 Mar  4  2013 git-receive-pack
-rwxr-xr-x.   1 root root     457272 Mar  4  2013 git-shell
-rwxr-xr-x.   1 root root    1138056 Mar  4  2013 git-upload-archive
-rwxr-xr-x.   1 root root     467536 Mar  4  2013 git-upload-pack

This IS a root account that I am dealing with though, could that have something to do with it?


As it turns out, this feature has been introduced in git 1.7.4. git --version gave me 1.7.1 on a base CentOS 6.4 install so that was the beginning of the issue =/

If you experience this problem, check your git version. Here's is an updater script that I wrote to aid you in your troubles.

# Git updater for RHEL systems

# CPR : Jd Daniel :: Ehime-ken
# MOD : 2013-11-18 @ 09:28:49

# REF : http://goo.gl/ditKWu
# VER : Version 1.1

# ROOT check
if [[ $EUID -ne 0 ]]; then
  echo "This script must be run as su" 1>&2 ; exit 1

yum install -y perl-ExtUtils-MakeMaker gettext-devel expat-devel curl-devel zlib-devel openssl-devel
cd /usr/local/src

git clone git://git.kernel.org/pub/scm/git/git.git && cd git
make && make prefix=/usr install

git --version
exit 0

Thanks to everyone who took the time to look into this, I appreciate it greatly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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