今天本地Git Push 代码推送远程分支,提示如下错误信息:

zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ git push
ssh: Could not resolve hostname github.com: No address associated with hostname
fatal: Could not read from remote repository.Please make sure you have the correct access rights
and the repository exists.

Google 一下,大家的建议是重新配置ssh Key。

重新生成GitHub SSH Key 值,请参考如下指令

zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ git config user.name
zhouzhiwengangzzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ git config user.email
zhouzhiwengang@163.comzzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ ssh-keygen -t rsa -C "zhouzhiwengang@163.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/zzg/.ssh/id_rsa):
/c/Users/zzg/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/zzg/.ssh/id_rsa
Your public key has been saved in /c/Users/zzg/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:ikXfYyRhWd/897SdPdU+Q/NKTgoZVFm4a4/4qzICidw zhouzhiwengang@163.com
The key's randomart image is:
+---[RSA 3072]----+
|        oo. .+.  |
|       ... ooo   |
|      . . o ..o  |
|     . . =  .  ..|
| . o .. S =  . o*|
|  o Eo . . +o .o@|
|    ...   oo oo**|
|      . o ...=..+|
|       . o.o+.o  |
+----[SHA256]-----+zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ eval $(ssh-agent -s)
Agent pid 909zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ ssh-add /c/Users/zzg/.ssh/id_rsa
Identity added: /c/Users/zzg/.ssh/id_rsa (zhouzhiwengang@163.com)zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ clip < /c/Users/zzg/.ssh/id_rsa.pub

执行以上指令完成本机SSH Key值生成,并将生成的Key 拷贝至Git 账户/Setting/SSH key 设置。

温馨提示:SSH Key 生成时,会提示本地已经存在是否覆盖,选择y,再Enter回车。

重新尝试git 代码推送

zzg@LAPTOP-8R0KHL88 MINGW64 /e/idea_workspace (master)
$ ssh -T git@github.com
ssh: Could not resolve hostname github.com: No address associated with hostname

错误含义:域名解析无法找到GitHub.

Google 一下,大家的解决办法时,将GitHub IP地址配置至hosts文件。

解决Github 域名方法问题: 

第一步:查询Github 真实IP地址,可以通过 https://www.ipaddress.com/查询。

第二步:在本机:C:\Windows\System32\drivers\etc\hosts 文件中,添加如下配置:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
140.82.113.4 github.com

至此,我的Git代码推送恢复正常。

Git提示:ssh: Could not resolve hostname github.com: No address associated with hostname相关推荐

  1. github 公钥 私钥_ubuntu git生成ssh key (公钥私钥)配置github或者码云

    Git是分布式的代码管理工具,远程的代码管理是基于SSH的,所以要使用远程的Git则需要SSH的配置. github的SSH配置如下: 设置Git的user name和email: git confi ...

  2. git 生成ssh key_ubuntu git生成ssh key (公钥私钥)配置github或者码云

    Git是分布式的代码管理工具,远程的代码管理是基于SSH的,所以要使用远程的Git则需要SSH的配置. github的SSH配置如下: 设置Git的user name和email: git confi ...

  3. git 出现错误 Could not resolve host: github.com 或者 gitlab.com 或者gerrit相关( 自有服务 )...

    原来是因为github.com没有被主机给解析 1.第一步是 ping 你的gitlab 或者 github服务器ip地址 如果每隔几秒有 time = xx.ms 刷新 就证明是通的 2. 编辑 e ...

  4. Android studio之提示Failed to resolve: com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46

    1.错误提示如下 Failed to resolve: com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.46 Show in Project ...

  5. 【Git笔记1】本地项目与GitHub远程仓库互联

    秋招面试的时候,面试官就问了我:你会Git吗?我迟疑看着他,他微笑着说,入职前要抓紧时间好好学习一下. 由于地理位置优势先来公司熟悉下环境,咨询算法组组长入职前可以做些什么准备?组长说,Git要好好学 ...

  6. [git]ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known

    ssh: Could not resolve hostname github.com: nodename nor servname provided, or not known This sounds ...

  7. git报错 ssh: Could not resolve hostname gitee.com:xxxxxx: Name or service not known fatal

    问题 使用git进行push操作时突然出问题,报错如下: ssh: Could not resolve hostname git: xxxxx:Name or service not known fa ...

  8. ssh: Could not resolve hostname github.com

    ssh: Could not resolve hostname github.com: Name or service not known fatal 可能原因 github上的key出了问题 个人网 ...

  9. 错误提示:ssh: Could not resolve hostname devsrv: Name or service not known

    ssh: Could not resolve hostname devsrv: Name or service not known ubuntu下 scp时出错:ssh: Could not reso ...

最新文章

  1. Javascript闭包和闭包的几种写法及用途
  2. 英伟达GPU“屠榜”,谷歌TPU“退赛”,MLPerf最新推理榜单出炉
  3. puppet 执行source
  4. leetcode63. Unique Paths II
  5. math.h头文件中声明了常用的一些数学运算
  6. 大型分布式网站架构设计与实践 第一章《面向服务的体系架构(SOA)》
  7. 浏览器解析编码优先级
  8. ArcGIS 10.2 Calculate Value(Data Management) 工具的使用
  9. 跳坑成功,手摸手带你使用PHP连接Oracle数据库
  10. c语言建立迷宫坐标,c语言 找到迷宫出口并显示坐标,可以自定义迷宫或者选用已经设计好的迷宫...
  11. 题号的随机抽取滚动背景以及题号展示背景如何定制?
  12. Stack with max and min 查找栈中最大最小数
  13. PS一键磨皮美白扩展插件Delicious Retouch 5.0 汉化集合版 Win/Mac
  14. Python 商务统计学 lesson 01
  15. 玩赚亚丁号---薅羊毛专业版
  16. Egret引擎学习笔记
  17. 教育企业邮箱购买哪个好用,还有英文邮件系统?
  18. 公链、私链、联盟链优缺点
  19. 字体样式字体分类字体样式二
  20. 医疗图像处理与深度学习(二)

热门文章

  1. 谈谈我对协议栈设计和架构的理解
  2. Python遗传算法求一元函数最大值
  3. 深度学习不得不知的英文名称
  4. Linux 中 vim编辑器如何跳转到指定的列、如何跳转到行首或者行尾、左右跳转
  5. Qt入门-文本框类QLineEdit和QTextEdit
  6. 微信小程序 - 获取用户当前位置信息(用于定位地址及获取地址等需求)
  7. PTS,SLM,Filter三种降低PAPR方法的matlab仿真
  8. Day442443444445446447448.K8s -谷粒商城
  9. windows ssh登录命令
  10. 了解信息学竞赛流程,快速入门!