解决ssh: connect to host github.com port 22: Connection refused
2017-04-18 12:17
1311 查看
问题引入
当你在Linux环境下配置好git并链接到后,你想要把本地的代码上传到github中。但是当你push的时候,会出现失败的情况。ssh git@github.com
使用上面的命令查看详细错误信息,得到以下结果
解决方法
然后我们进入.ssh的配置目录查看,发现ssh目录里少了配置文件config。找到原因后我们进入.ssh的目录,使用命令“touch config”创建一个配置文件,并写入你github的配置信息。(xxxxx@xx.com是你github的注册邮箱)
Host github.com User xxxxx@xx.com Hostname ssh.github.com PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa Port 443
现在再使用ssh git@github.com查看与github的连接状态,可能出现错误Bad owner or permissions on
这是因为你创建的配置文件config的权限不够。所以我们需要修改其权限。使用下面命令。
sudo chmod 600 config
现在我们再尝试查看连接状态发现已经成功连接。
接下来就可以成功的push你的代码到github了。
相关文章推荐
- 解决ssh-connect-to-host-github-com-port-22-connection-timed-out
- GitHub上传不了的解决 ssh: connect to host github.com port 22
- 解决ssh-connect-to-host-github-com-port-22-connection-timed-out
- 解决ssh-connect-to-host-github-com-port-22-connection-timed-out
- SSH连接GitHub出现 ssh: connect to host github.com port 22: Connection refused解决方法
- connect to host ssh.github.com port 22: Connection timed out解决方法
- 2.git 连接报"ssh: connect to host github.com port 22: Connection timed out"错误
- 解决ssh: connect to host gitlab.com port 22: Connection timed out
- git clone遇到的[ssh: connect to host github.com port 22]
- 解决 connect to host github.com port 22 operation timed out
- ssh: connect to host github.com port 22: Connection timed out
- ”ssh: connect to host gmail.com port 22: Network is unreachable"的解决办法
- github连接报"ssh: connect to host github.com port 22: Connection timed out"错误
- ssh: connect to host github.com port 22: Bad file number
- ssh: connect to host github.com port 22: Connection refused
- ssh: connect to host github.com port 22: Connection timed out
- git ssh: connect to host gitub.com port 22解决办法
- git配置的时候出现connect to host github.com port 22 bad file number解决办法
- github连接报"ssh: connect to host github.com port 22: Connection timed out"错误
- Git克隆提交出现“ssh: connect to host github.com port 22: Operation timed out fatal”问题