异常:fatal: unable to access 'https://git.oschina.net/pcmpcs/library.git/': Could not resolve host

git  fork项目时出现的异常.

原因: 我以前用的是ssh地址做的远程通信地址,而这次是用的是https,因为很久没用,所以忘记了以前是用ssh的了。
解决方案一:复制ssh协议的地址,然后再关联远程仓库。
并且在VCS下的git下的Remotes中去掉https的地址
(也可以在VCS下的git下的Remotes中关联远程仓库的地址)
注意:
ssh协议地址:git@git.oschina.net:yiter/mkbzh.git
https协议地址:https://git.oschina.net/yiter/mkbzh.git
解决方案二:换成https协议
1.git remote -v  //查看当前远程服务器地址
origin  git@git.oschina.net:yiter/mkbzh.git (fetch)
origin  git@git.oschina.net:yiter/mkbzh.git (push)
发现是ssh的,所以我用https地址一直报错。
2.git remote set-url --add origin https://git.oschina.net/yiter/mkbzh.git(https协议的)
通过如上命令修改了地址方式,再次通过  git remote -v 发现已经变成https协议了

posted @ 2017-09-19 14:51  inspire0x001  阅读(413)  评论(0编辑  收藏  举报