Git 克隆僅適用於 ssh://git@.. 而不適用於 git@

Git 克隆僅適用於 ssh://git@.. 而不適用於 git@

知道為什麼 GIT 儲存庫僅在使用時才起作用,而在使用時不起作用嗎?ssh://[email protected]/repo.git[email protected]/repo.git

這是由其他人設定的伺服器,所以不知道它是如何設定的,但在 BitBucket 或 GitHub 上我可以使用它[email protected]/repo.git,它可以工作並使用 SSH 協定克隆儲存庫。知道為什麼這個伺服器 iy 僅在使用時才起作用嗎?ssh://[email protected]/repo.git

所以我需要ssh://在前面添加。

答案1

您使用的語法不正確。

當您刪除scheme://前綴時,git 不再以 URL 樣式解釋您的位址,而是以 rcp/scp 樣式解釋。但對於 rcp/scp 樣式位址,必須使用 a 將路徑與 user@host 分開冒號:(不支援指定連接埠)。例如:

git clone [email protected]:repo.git

git clone [email protected]:daniels/example.git

如果沒有冒號,git 只會將位址解釋為本機路徑。

(您可以在複製或者git 獲取手冊頁。

相關內容