git push not finding host

Deadly 提交于 2019-12-10 17:36:07

问题


I am attempting to push to a remote repo that I have already been pushing to, however now I am getting an error I don't understand.

git push
ssh: Could not resolve hostname github.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.

Then I did a git status

On branch master
Your branch is ahead of 'origin/master' by 2 commits.
  (use "git push" to publish your local commits)
nothing to commit, working directory clean

Then I ran git remote -v

origin  git@github.com:<username>/<projectName>.git (fetch)
origin  git@github.com:<username>/<projectName>.git (push)

I would greatly appreciate some guidance. My gut tells me this isn't a git issue but some networking issue. Any help is appreciated.


回答1:


Apparently there is some bug with the Apple's discoveryd process. I read about the problem Here and Here

I killed the process, and everything worked fine.




回答2:


It looks like you are trying to use 'git' protocol to fetch/push. By default it uses 9418 port to connect. Refer to Git Protocol Docs. Some firewall setting must be blocking this port, or just the port that is assigned to this protocol. Either look in firewall settings or attempt to clone via ssh rather than GIT like this:

git remote set-url --push origin ssh://github.com:<username>/<projectName>.git (push)

Syntax may need corrections though.



来源:https://stackoverflow.com/questions/32215254/git-push-not-finding-host

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!