关于 Git 使用中出现的错误

饥人谷_楠柒 关注

2016.11.02 15:33* 字数 746 阅读 3607评论 5喜欢 10赞赏 1

关于错误:ssh: Could not resolve hostname github.com: Name or service not known.fatal: Could not read from remote repository.

 
QQ截图20161102144048.jpg

在我配置完公钥后想要进行远端Github上clone时出现了错误。经过网上查询发现在配置git时要验证是否成功。要在git bash 下输出$ ssh -T git@github.com如果是第一次的会提示是否continue,输入yes就会看到:You’ve successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上github。

但是 我输入后并不是这样的,我的显示Host key verification failed.于是查询中。。。。。
经查找后发现我在git bash 下打出ping github.com 不显示ip。之前对git使用并不太了解。也在网上查找了相关错误的解决办法但都没有用。(如该DNS等等)最后还是找到了问题的所在。

如果有朋友出现了以下三条错误可以按我下面的操作试试。
错误1.

 
QQ截图20161102144048.jpg

clone
ssh:无法解析主机名github.com:名称或服务不知道
无法读取远程存储库。
请确保您有正确的访问权限
和存储库存在。(错误代码)

错误2.
在git bash 下输出$ ssh -T git@github.com也显示错误。(表示git连接github失败)

错误3.
在git bash 下打出ping github.com 不显示ip。

原因有可能是本地DNS无法解析导致的。造成该问题的因素可能有多种,安全防护类软件、病毒、优化或清理等导致本地DNS解析文件被清除或更改,DNS缓存问题,Winsock目录问题等。

解决办法

  1. 先去复制一下别人的hosts 该文件在C:\Windows\System32\drivers\etc路径下
    把复制的文件放入该路径下 原来的不要

     
    QQ截图20161102151526.jpg
  2. 进入cmd (开始->搜索文件和程序->打入cmd->enter)
    输入:ipconfig /flushdns 释放DNS缓存。
    输入:netsh winsock reset 重置Winsock目录。
    会有提示:必须重启计算机才能完成重置。
    先不要着急重启。

  3. 在cmd里随意ping一个网址试试(如图)

 
QQ截图20161102152243.jpg

无丢失表示成功了。再重启你的计算机。

  1. 重启后进入你的git bash 试试 ping github.com
    应该会显示你的ip地址。在git bash下输出$ ssh -T git@github.com如果是第一次的会提示是否continue,输入yes就会看到:You’ve successfully authenticated, but GitHub does not provide shell access 。这就表示已成功连上github。

  2. 之后你的git clone就不会出现错误提示(
    ssh: Could not resolve hostname github.com: 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.

这只是我个人在使用git时碰到的问题,希望能够帮助其他朋友。如果有朋友再使用git时还碰到其他解决不了的问题希望我可以帮到你(请留言)。建议碰到问题先在网上自己查询,虽然很浪费时间但问题的所在和解决的办法或让你难以忘怀!!

git提示错误关于错误:ssh: Could not resolve hostname github.com: Name or service not known.fatal: Could not read from remote repository.的更多相关文章

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

    问题描述 今天早上在自己的虚拟机上用git pull命令更新github上的版本库时提示下面的错误 [root@localhost ~] git clone git@github.com:sdscbr ...

  2. 关于github报错 ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository.

    今天上午写demo的时候,突然pull不下代码了,报了一下这样情况的错误: 看了一下代码,怀疑是网路错误,因为在这以前一切都正常的,然后将代码复制搜索了一番,解决办法有很多什么配置config啦,gi ...

  3. git错误--ssh: Could not resolve hostname ssh.github.com: Name or service not known--解决方式

    错误如下: git push origin ssh: Could not resolve hostname ssh.github.com: Name or service not known fata ...

  4. mac 配置 ssh 到git (Could not resolve hostname github.com, Failed to connect to github.com port 443 Operation timed out)

    1.进入终端命令行 (1)输入:cd .ssh/ 进入到.ssh后,输入ls,会输出“known_hosts”,如果没有创建过rsa的话 (2)输入:man ssh-add (3)输入:ssh-key ...

  5. ssh: Could not resolve hostname问题终于解决了?

    1.如果系统为64位,无法启动启动hdfs: ./sbin/start-dfs.sh.并有以下错误: sed: -e expression #1, char 6: unknown option to  ...

  6. git clone ssh 时出现 fatal: Could not read from remote repository

    一.问题及解决办法参考: 在 ubuntu 中,要把 GitHub 上的储存库克隆到计算机上时,执行如下命令: git clone git@github.com:USER-NAME/REPOSITOR ...

  7. ssh: Could not resolve hostname git.*****-inc.com : Temporary failure in name resolution fatal: The remote end hung up unexpectedly

    问题出现的情景:使用git pull拉取开发的代码到测试服务器,报错: ssh: Could not resolve hostname git.****-inc.com : Temporary fai ...

  8. 用ssh进行git clone出现 fatal: Could not read from remote repository.

    问题:在通过MobaXterm进行ssh连接的服务器上用ssh进行git clone出现 fatal: Could not read from remote repository. 解决方法:prox ...

  9. 【git基础】Permission denied (publickey). fatal: Could not read from remote repository

    运行以下git命令的时候出现错误 git push -u origin master error The authenticity of host 'github.com (13.250.177.22 ...

随机推荐

  1. day 07

    # 数据类型的相互转化# 字符编码# 文件操作 # 1.哪些类型可以转化为数字# res = int('10')# print(res)# res = int('-3')# print(res)# r ...

  2. ejs常用功能函数

    利用<%- include filename %>加载其他页面模版: 1.缓存功能,能够缓存已经解析好的html模版: 2.<% code %>用于执行其中javascript ...

  3. 西安理工大学 李爱民 Xi'an University of Technology, Aimin Li

    李爱民-西安理工大学计算机科学与工程学院 ● 简介(Introduction)-> 李爱民(Aimin Li),男,湖北随州人,西安电子科学大学博士(PhD),中共党员.中国计算机学会会员,CS ...

  4. 使用 pm2 优雅的部署 node 程序

    使用 pm2 优雅的部署 node 程序 # 启动并监控名字为 XXX 的 npm run start:dev 命令 pm2 start npm --watch --name XXX -- run s ...

  5. mysql workbench快捷键小结

    执行整篇sql脚本, ctrl+shift+enter 执行当前行,ctrl+enter 注释/取消注释, ctrl+/   [注意]这里的 / 指的是小键盘中的除法Divide符号格式化sql语句( ...

  6. 【python 3】 字典方法操作汇总

    基础数据类型:tuple 1.1  新增 dic["key"] = value                            字典中没有key就添加,有key就覆盖 dic ...

  7. npm ERR! File exists: /XXX/xxx npm ERR! Move it away, and try again.

    今天抽空将我的静态服务 ks-server 之前留下的 bug(在node低版本情况下报错)维护了一下. 当我重新 npm link 时,如下错误: npm WARN ks-server@1.0.2 ...

  8. POJ 1061 青蛙的约会(拓展欧几里得)

    #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #i ...

  9. clojure开发环境配置git, vscode+Calva插件配置

    万事开头难,全是犄角旮旯的细节. 1 安装lein 参见 https://www.cnblogs.com/xuanmanstein/p/10504401.html 2 创建工程 lein 参考http ...

  10. numpy 数组索引数组

    在numpy中,数组除了可以被整数索引,还可以被数组索引. a[b]就是已数组b的元素为索引,读取数组a的值. 当被索引数组a是一维数组,b是一维或则多维数组时,结果维度维度与索引数组b相同. a = ...