2010-07-29 60 views
8

我的一個同事有一個遠程git回購,我想克隆,他提供了一個[email protected]網址:443/repo.git。在這種情況下,ssh在端口443上列出。git克隆需要ssh://協議時,它可能不應該?

我試圖克隆做git clone [email protected]:443/repo.git但操作超時。我曾經認爲git默認爲ssh作爲其協議,我不知道爲什麼這不起作用。

如果我明確指定像git clone ssh://[email protected]:443/repo.git這樣的url中的ssh,它就像平常一樣工作。

這是預期的git行爲?爲什麼第一個網址不起作用,但第二個網址卻不行?

回答

10

是的。 「默認」克隆語法是類似於scp的。 scp URL看起來像「user @ host:path」。注意冒號;如果您使用[email protected]:443/repo.git,Git認爲您試圖從[email protected]克隆路徑443/repo.git。如果你需要指定一個端口,你必須使用ssh風格的語法(就像你最終做的那樣)。

+2

或者使用'.ssh/config'指定端口。 – 2010-07-29 20:55:41

+0

你的意思是每個客戶端都必須編輯'〜/ .ssh/config'嗎?我們不能做這個服務器端嗎? – 2013-06-22 10:43:40