git push出错,求帮助?

我在win下使用git推送到github遇到了这个问题
请问该怎么解决

$ git push -u origin master
ssh: Could not resolve hostname xxx: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
阅读 3.5k
2 个回答

git remote -v 检查你的origin路径是否合法。一般来说应该为:

ssh://git@<host>:<port>/path_to_source.git 

从报错信息来看,是找不到xxx这个主机;

  1. 确保仓库地址正确

  2. 修改hosts文件,添加host名字和IP的对应关系,或者修改.git/config文件下的origin的url为IP地址

检查下dns,没问题的话检查下你要push到的仓库里是否有你当前机器的公钥。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进