Osx-Snow-Leopard

無法從執行 gitosis 的雪豹伺服器本地複製 gitosis-admin.git

  • June 22, 2011

我已經按照此處所述安裝了 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 git@10.0.0.108: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://git@10.0.0.108: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://git@10.0.0.108: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: 'git@10.0.0.108: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 git@192.168.155.101: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

工作正常。

引用自:https://serverfault.com/questions/124607