初次接触GIT,跟着教程走的时候遇到问题,记录如下,另外使用的是用VM虚拟的Ubuntu14环境
➜ ssh -T git@github.com
ssh: connect to host github.com port 22: Connection refused
ssh: connect to host github.com port 22: Connection refused
ssh服务被拒绝,简单粗暴。。
这里还得说下,最开始还需要安装 OpenSSH Server,一行命令搞定:
sudo apt-get install openssh-server
然后查看服务是否启动:
看到sshd就表示启动成功了。
紧接着就是处理正事,google搜索了下,在stackoverflow上有相关解答(已经爱死stackoverflow,各种疑难杂症都能搜得到!),解决方法是:
$ vim ~/.ssh/config
在其中添加
Host github.com
Hostname ssh.github.com
Port 443
(Tips:VIM编辑器退出方法:编辑好后,点击ESC,然后输出":",然后输入“ws”,表示write&save)
修改后再测试一下:
$ ssh -T
git@github.com
The authenticity of host '[ssh.github.com]:443 ([192.30.252.149]:443)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.252.149]:443' (RSA) to the list of known hosts.
Hi lzlun129! You've successfully authenticated, but GitHub does not provide shell access.
The authenticity of host '[ssh.github.com]:443 ([192.30.252.149]:443)' can't be established.
RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[ssh.github.com]:443,[192.30.252.149]:443' (RSA) to the list of known hosts.
Hi lzlun129! You've successfully authenticated, but GitHub does not provide shell access.