git push not finding host

2019-06-24 04:11发布

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.

标签: git github push
2条回答
Root(大扎)
2楼-- · 2019-06-24 04:50

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.

查看更多
等我变得足够好
3楼-- · 2019-06-24 04:53

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.

查看更多
登录 后发表回答