ssh: Could not resolve hostname gitcafe.com: nodename nor servname provided, or not known

今天 git push 的时候报如下错误:

ssh: Could not resolve hostname gitcafe.com: nodename nor servname provided, or not known

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.

  最开始还以为是权限被修改了,后来问了朋友下,他建议使用 https 协议试试,看是否成功,如何在使用 ssh 协议的同时又使用 https 协议呢?我们只需要新增一个 remote 即可,步骤如下:

1、添加远程仓库 

git remote add remoteName url

  remoteName 仓库名称,可以自定义,不可和已有的仓库名称同名。这个名称,push和pull的时候是需要用到的。默认的是 origin

2、获取或推送

// pull
git pull remoteName branchName

// push
git push remoteName branchName

  结果发现push成功了,因此可以排除权限问题了。

 

那么出现这个原因的问题是什么?可能是服务器不稳定导致 ssh协议被gateway认证失败了,或者一些其他未知的原因。

posted @ 2015-07-20 20:37  破男孩  阅读(4525)  评论(0编辑  收藏  举报