git clone 的时候报错:
$ git clone git@github.com:xxx/xxx.git
Cloning into 'xxx'...
ssh: connect to host github.com port 22: Connection refused
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
这个时候在命令行执行下面的命令(如果不会 vim,就去对应的 .ssh
目录里建一个 config文件。注意是没有任何后缀的文件):
vim ~/.ssh/config
然后把下面的代码复制进去,保存。
Host github.com
Hostname ssh.github.com
Port 443
然后在命令行执行下面的命令:
ssh -T git@github.com
他会有个提示(也可能没有):
Are you sure you want to continue connecting (yes/no/[fingerprint])?
根据他的提示,输入 yes
,按回车,他就会提示:
Hi `your username`! You've successfully authenticated, but GitHub does not provide shell access.
再重新 git clone 就可以了。