我已经按照此处所述安装了 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
我已经寻找解决方案近一周了,但我在互联网上找到的每个主题都没有结果......
答案1
我总是遇到同样的问题,找出原因有点棘手。我尝试通过 IP 交换服务器名称:
git 克隆 git@frontend1:gitosis-admin.git
经过
git 克隆[电子邮件保护]: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 克隆 git@frontend1:gitosis-admin.git
工作得很好。
答案2
尝试将 git 用户 shell 从 git-shell 更改为 sh
例如:
从
git:x:1000:1000::/home/git:/usr/bin/git-shell
到
git:x:1000:1000::/home/git:/bin/sh
这对我有帮助。
答案3
我在 Ubuntu Linux 10.04 (lucid lynx) 上尝试安装 gitosis 时遇到了同样的问题。我卸载了 gitosis,删除了主目录(对我来说是 /srv/gitosis/),然后重新启动了Ubuntu 社区 git 页面当我进行到该步骤时,该问题没有再出现。