[英]SSH Clone Gitlab connection to host HOSTNAME port 22: Connection timed out
[英]git clone fails with ssh port 22 connection timed out
我從Windows 11工作站通過Oracle VM VirtualBox安裝了CentOS 7 nix OS。 然后我通過Docker 安裝了最新的 gitlab 。 到目前為止,我能夠做到以下幾點:
The problem I am having is when I tried to run git clone git@localhost:john/hello-world.git
I am getting ssh: connect to host localhost.com port 22: Connection timed out fatal: Could not read from remote repository. .
我閱讀了一些關於它的文章,包括這個並嘗試了它的建議解決方案,雖然我不明白: ssh: connect to host github.com port 22:
如果有人能向我解釋為什么會發生這種情況/如何解決它,我將不勝感激。 我是 linux + 網絡 + ssh 的新手。
更新:
這不是我發布的問題的解決方案,而是我的臨時解決方案。
我決定使用用戶名/密碼,而不是使用ssh 密鑰,這允許我下載git bash中的存儲庫。 我做了兩件事。
git clone http://john@localhost/john/hello-world.git
首先確保您完全可以通過 ssh 訪問您的 VM:運行
ssh <user>@<host>
# you can add '-v' to have more information on what ssh is trying to do
兩個備注:
主機:如果您的虛擬機可以通過您的主機網絡訪問,則它不會使用 127.0.0.1 IP ( localhost
)。 嘗試連接到虛擬機的 IP,或者,如果您在etc/hosts
中為您的虛擬機添加了一個名稱,則使用此名稱: ssh git@mylocalvm
用戶帳戶:您提到您創建了一個john
帳戶,但沒有創建git
帳戶。 在您的 VM 上創建一個非 root git
帳戶,或嘗試ssh john@mylocalvm
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.