git ssh: connect to host gitub.com port 22解决办法

来源:互联网 发布:泰语翻译中文软件 编辑:程序博客网 时间:2024/06/05 08:52
最近在研究git,当我把本地库和网络库创建好后,由本地库和服务器仓库关联时,出现ssh: connect to host gitub.com port 22: Connection refused

fatal: Could not read from remote repository.

我的本地环境是windows,我的push命令如下:

$ git remote add origin (git@github.com:xxx/xxxx.git)这个命令是成功的,因为没有任何的错误提示(linux中没有提示的是最好的,意味着你的操作成功)

$ git push -u origin master执行这个命令是,提示以上错误,按照网上的办法,test了一下服务器ssh -T git@github.com ,没有任何问题,重新生成密钥,导入到服务器依然没有解决,最后

git config --local -e
将url = git@github.com:username/repo.git改为url = https://github.com/username/repo.git(此地址由github网站上点击ssh生成的)

然后保存,再次执行

发现可以了,我想应该有不少windows下面的git用户遇到此问题吧,希望能帮助大家。

0 1
原创粉丝点击