搭建github-ssh连接时,Could not resolve hostname github的解决方案(无法ping通github)

这篇具有很好参考价值的文章主要介绍了搭建github-ssh连接时,Could not resolve hostname github的解决方案(无法ping通github)。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

解决无法 ping 通 github.com 的问题

测试平台:Windows 10

测试时间: 2022年3月4日

问题描述:

​ 笔者在进行搭建本地 git 时,需要通过 ssh 建立与 github 的连接,在进行ssh连接验证时,出现如下提示

ssh: Could not resolve hostname github.com: Name or service not known

​ 此时对目标地址进行 ping 操作如下

ping github.com

出现如下错误提示(git bash)

Ping request could not find host github.com. Please check the name and try again.

windows的cmd 我没复制,但大致提示无法访问远程主机,连接不可建立

解决方案:

首先获取 github.com IP 地址

IP 地址查询: Click

通过上述网站查询得到 github.com IP 地址如下

140.82.113.4

此时修改本地 DNS 文件 C:\Windows\System32\drivers\etc 目录下的 hosts 文件

由于该文件在 C 盘中,无法直接打开进行修改,需要使用管理员权限

此处操作方式为,搜索 记事本 软件,右键以管理员身份运行

通过左上角文件->打开,选择上述 hosts 文件打开,在文件内容最下方加入一行

140.82.113.4    github.com

完成后保存即可。

此时再次 ping github.com 即可看到能够成功 ping 通文章来源地址https://www.toymoban.com/news/detail-402329.html

$ ping 140.82.113.4

Pinging 140.82.113.4 with 32 bytes of data:
Reply from 140.82.113.4: bytes=32 time=229ms TTL=42
Reply from 140.82.113.4: bytes=32 time=229ms TTL=42
Reply from 140.82.113.4: bytes=32 time=229ms TTL=42
Reply from 140.82.113.4: bytes=32 time=229ms TTL=42

Ping statistics for 140.82.113.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 229ms, Maximum = 229ms, Average = 229ms

到了这里,关于搭建github-ssh连接时,Could not resolve hostname github的解决方案(无法ping通github)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • ssh: Could not resolve hostname guard.: Name or service not known

    记录一下 安装hbase,正确配置hbase的配置文件后,在hbase/bin目录下命令**./start-hbase.sh**启动hbase服务 出现报错ssh: Could not resolve hostname slave1: Name or service not known lost connet 百度后看了很多解决办法, 无非就是防火墙、主机名+ip在某个文件有错误 仔细排查后,发现是从教室copy回来

    2024年02月12日
    浏览(41)
  • git 遇到 ssh: Could not resolve hostname -: Name or service not known

    提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档 提示:这里可以添加本文要记录的大概内容: git clone 遇到ssh: Could not resolve hostname -: Name or service not known错误时,网上其他方法失效可以尝试一下!!!! https://blog.csdn.net/yehaocheng520/article/details/1072030

    2024年02月13日
    浏览(39)
  • 解决ssh: Could not resolve hostname ***: nodename nor servname provided, or not known报错

    今天新搞到一台linux服务器,使用域名登陆服务器时遇到了如下报错: ssh: Could not resolve hostname ***: nodename nor servname provided, or not known 网上有一种说法,首次使用ssh命令登陆服务器时,可以先ping一下这个地址,让本地的hosts缓存该地址的名字,再尝试ssh登陆。 事实证明,这种

    2024年02月07日
    浏览(33)
  • master: ssh: Could not resolve hostname master: Name or service not known的解决方法

    第一种解决方法是未修改linux系统中的host文件,这个在其他人的文章中又阐述,这里就不做介绍。 如果第一种解决方法不能解决,则可以用如下的方法: 如图,在真机器的如下的文件路径中搜索并修改host文件 搜索“命令提示符”,点击“以管理员权限运行”,再输入如下图

    2024年02月04日
    浏览(33)
  • 【已解决】ssh: Could not resolve hostname hadoop102: Name or service not knownlost connection

    在 [root@hadoop101 software] 输入 # scp -r /usr/java/ hadoop102:/usr/ 出现如图所示问题,   搜索资料明白:需要将服务器hostname与对应的IP地址加到文件名/etc/hosts中,也就是区分master、slave1、slave2,我这里命名为hadoop101、hadoop102、hadoop103。 解决方法:如图所示。  详细做法: 输入第一个

    2024年02月11日
    浏览(40)
  • git报错 ssh: Could not resolve hostname gitee.com:xxxxxx: Name or service not known fatal

    报错:局域网内的gitlab提交 fatal: Could not read from remote repository. ssh: Could not resolve hostname gitee.com:xxxxxx: Name or service not known fatal 第一种可能是: 用户的账号密码不对导致的: 修改本地的账号密码: 第二种:本地的公钥错误,重新获取公钥 第三种:我遇到的问题,自己使用ip地

    2024年02月05日
    浏览(34)
  • 【已解决,可放心食用】spark-slave1: ssh: Could not resolve hostname spark-slave1: Name or service not know

    开启hadoop集群的时候遇到了这个问题 我的问题比较好解决,一眼就能看出来,是因为slave和配置文件中的不对应。然后我就去查了查还有没有其他形式的,比如不是因为配置文件里面写错名字这种低级错误还是有这种情况的,大概有以下几种情况和解决方案 一定要配置免密登

    2024年02月05日
    浏览(36)
  • Failed toconnect to github.com port 443: 拒绝连接 Could not resolve host: github.com

     下面的命令只针对 github.com ,在国内还可能会用到 gitee.com ,所以不能将所有的 git 站点都添加上代理。  使用cdn加速 或者 2.1 打开hosts文件  2.2 在添加github.com域名(localhost下添加即可)  如果不行或者网速过慢可以尝试换个域名,在网上能搜到

    2024年02月08日
    浏览(38)
  • Could not resolve com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.28.

    1、首先进入阿里云maven仓库,在搜索栏输入无法下载的依赖名称,查询现有版本号,可以看到这里有2.9.34。 2、在build.gradle(Project)的buildscript闭包下替换为阿里云maven仓库: 3、在build.gradle(Project)的allprojects闭包下也替换为阿里云maven仓库: 4、然后修改build.gradle中的依赖版本,

    2024年02月03日
    浏览(35)
  • 【解决问题 fatal: unable to access ‘https://github.com/.../.git‘: Could not resolve host: github.com】

    1.发现vulhub靶场不全,重新下载发现下这个问题,记录一下。 2.出现以下报错,如下图 fatal: unable to access ‘https://github.com/…/.git’: Could not resolve host: github.com 3.只需要在命令行中执行 git config --global --unset http.proxy git config --global --unset https.proxy 4.既可解决以上问题。

    2024年02月05日
    浏览(42)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包