通过ssh连接到服务器时发生Git错误

时间:2013-04-16 12:36:08

标签: git ssh

我在Windows 7上,我想通过ssh连接到服务器。但是我在验证后得到了一个错误(这是成功的)。

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

我有一个git但是我用google搜索是因为缺少git-shell-commands目录。是的,我在git安装后在我的主目录中没有这个文件夹,但我创建了它并给了一个权限。我还安装了类似'msysgit'的东西(因为当我从exe安装git时我没有git-shell-commands目录,在msysgit中有这个文件夹所以我把它复制到我的主目录)但是仍然有问题,得到了这个错误。有任何想法吗?在此先感谢您的帮助。

2 个答案:

答案 0 :(得分:0)

您应该在服务器端为 git 用户设置正确的登录shell。通常它位于 / usr / local / bin / git-shell

答案 1 :(得分:0)

应用以下两个命令将解决此问题:

为your_git_user启用git-shell:

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

要递归更改your_git_user目录的所有者:

chown -R your_git_user:your_users_group /home/your_git_user

您可以使用以下命令添加git shell命令:

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

相关问题