我已经按照此处所述安装了 gitosis:http: //gist.github.com/264304
我必须调整的一件事是授予我的 git 用户使用 ssh 的权限(我通过服务器管理员 -> 访问 -> ssh 并添加了“git”用户)。
当我以 git 用户身份从本地计算机 (mac osx) 进行 ssh 时,我收到以下响应:
PTY allocation request failed on channel 0
bash: gitosis-serve: command not found
Connection to 10.0.0.108 closed.
我认为这是正常的,因为在 Pro GIT 中,作者说如果你尝试使用你的 git 用户 ssh 到服务器,你应该得到这样的东西:
PTY allocation request failed on channel 0
fatal: unrecognized command 'gitosis-serve schacon@quaternion'
Connection to gitserver closed.
到目前为止一切顺利,我想?现在,当我尝试使用以下命令克隆我的 gitosis-admin.git 存储库时:
$git clone [email protected]:gitosis-admin.git
我明白了:
Initialized empty Git repository in /Users/joggink/gitosis-admin/.git/
bash: gitosis-serve: command not found
fatal: The remote end hung up unexpectedly
所以在做了一些搜索之后,我在 serverfault 上找到了一个答案,声称我应该使用 ssh:// 作为我的 git clone 的协议(我认为这是默认的 git 协议?)但是,当我尝试时:
$git clone ssh://[email protected]:gitosis-admin.git
这是回应:
The authenticity of host ' (::1)' can't be established.
RSA key fingerprint is 80:4d:77:c7:78:cb:c9:42:e3:82:06:7c:fe:c0:08:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password:
Password:
Password:
Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly
当我输入自己的密码时(因为我的 git 用户没有密码),我收到以下错误:
The authenticity of host ' (::1)' can't be established.
RSA key fingerprint is 80:4d:77:c7:78:cb:c9:42:e3:82:06:7c:fe:c0:08:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password:
bash: git-upload-pack: command not found
fatal: The remote end hung up unexpectedly
我添加了我的上传包位置,如下所示:
$git clone -u /usr/local/git/bin/git-upload-pack ssh://[email protected]:gitosis-admin.git
我收到 gitosis-admin.git 不是 git repo 的错误...
Initialized empty Git repository in /Users/joggink/gitosis-admin/.git/
The authenticity of host ' (::1)' can't be established.
RSA key fingerprint is 80:4d:77:c7:78:cb:c9:42:e3:82:06:7c:fe:c0:08:ce.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '' (RSA) to the list of known hosts.
Password:
fatal: '[email protected]:gitosis-admin.git' does not appear to be a git repository
fatal: The remote end hung up unexpectedly
我一直在寻找一个近一周的解决方案,我在互联网上找到的每个主题都没有结果......
我总是遇到同样的问题,找出原因有点棘手。我尝试通过 IP 交换服务器名称:
git clone git@frontend1:gitosis-admin.git
经过
git clone [email protected]:gitosis-admin.git
并得到了 gitosis-serve 未找到的消息,即使用 .ssh/authorized_keys 调用 gitosis-serve 时不包含 /usr/local/bin 路径。
因此,在文件~git/.ssh/authorized_keys(作为管理员)中,我将gitosis-serve 替换为/usr/local/bin/gitosis-serve,即全路径名。之后,命令
git clone git@frontend1:gitosis-admin.git
工作正常。
尝试将 git 用户 shell 从 git-shell 更改为 sh
例如:
从
git:x:1000:1000::/home/git:/usr/bin/git-shell
到
git:x:1000:1000::/home /git:/bin/sh
这对我有帮助。
尝试在 Ubuntu Linux 10.04 (lucid lynx) 上安装 gitosis 时遇到了同样的问题。我卸载了 gitosis,删除了主目录(对我来说是 /srv/gitosis/)并重新启动了Ubuntu 社区 git 页面上的说明。当我到达那一步时,问题没有再次出现。