從 Gitlab 透過 ssh clone 發生錯誤 – port 22: Network is unreachable
git 要 pull 或 push 時都出現下列錯誤訊息
$ git clone [email protected]:user/projectName.git
Cloning into 'projectName'...
ssh: connect to host gitlab.hostname port 22: Network is unreachable
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
解法
打開 ~/.ssh/config
加入以下資訊,存檔即可
Host gitlab.hostname
HostName {host ip}
User user
Port 22
reference:
https://about.gitlab.com/blog/2016/02/18/gitlab-dot-com-now-supports-an-alternate-git-plus-ssh-port/