我正在尝试安装 git 服务器。当我将 git 用户的默认 shell 设置为 /usr/bin/git-shell 时,我在以 git 身份登录时收到错误消息。
fatal: Interactive git shell is not enabled.
hint: ~/git-shell-commands should exist and have read and execute access.
Run Code Online (Sandbox Code Playgroud)
基于 ssh 密钥的访问工作,权限设置正确。
Google 搜索未显示有关此错误的任何信息。
我在过去的安装中也使用了这种方法,但没有显示此类错误。我还查看了工作服务器是否有一些额外的文件或配置但没有这样的东西。
系统规格:
/etc/passwd 行:
git:x:1002:1004::/home/git:/usr/bin/git-shell
Run Code Online (Sandbox Code Playgroud)
小智 17
我运行后发现了这个 locate git-shell-commands
cat /usr/share/doc/git-1.7.4.4/contrib/git-shell-commands/README
可通过 git-shell 调用的示例程序。在 shell 为 git-shell 的用户的主目录中放置一个名为 'git-shell-commands' 的目录。然后,任何以该用户身份登录的人都可以在“git-shell-commands”目录中运行可执行文件。
提供的命令:
help: 打印出可用命令的名称。当以交互方式运行时,git-shell 将在启动时自动运行 'help',前提是它存在。
list:显示用户主目录下名称以“.git”结尾的任何裸仓库。没有其他 git 存储库是可见的,尽管它们可以通过 git-shell 克隆。“list”旨在最大限度地减少在查找可用存储库时必须调用 git 的次数;如果您的设置具有用户可发现的其他存储库,您可能希望相应地修改“列表”。
所以我以 root 身份运行了以下命令:
cp /usr/share/doc/git-1.7.4.4/contrib/git-shell-commands /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
exit
Run Code Online (Sandbox Code Playgroud)
然后我能够以git用户身份运行以下命令:
[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
Run Code Online (Sandbox Code Playgroud)
现在我看不到什么好的帮助和列表,但登录有效。:)
小智 5
我只需要做# mkdir ~git/git-shell-commands然后su git工作git 1.8.1.5-r1
如果您查看触发该错误消息的代码(这在旧版本的 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.");
Run Code Online (Sandbox Code Playgroud)
这应该是 git-shell 目录上的正确问题。
用户必须具有该目录的读取和执行权限才能执行其中的程序。
| 归档时间: |
|
| 查看次数: |
41697 次 |
| 最近记录: |