关于 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. 关于Java多线程的一些常考知识点

    前言 Java多线程也是面试中经常会提起到的一个点.面试官会问:实现多线程的两种方式以及区别,死锁发生的4个条件以及如何避免发生死锁,死锁和活锁的区别,常见的线程池以及区别,怎么理解有界队列与无界队列 ...

  2. Python-王者荣耀自动刷金币+爬取英雄信息+图片

    前提:本文主要功能是 1.用python代刷王者荣耀金币 2.爬取英雄信息 3.爬取王者荣耀图片之类的. (全部免费附加源代码) 思路:第一个功能是在基于去年自动刷跳一跳python代码上面弄的,思路 ...

  3. JS高程关于ajax的学习笔记

    1.ajax介绍 ajax技术可以实现浏览器向服务器请求数据时不需要重新加载页面,就可以从服务器中获取需要的数据. ajax技术的核心是XMLHttpRequest对象(简称XHR),XHR对象为向服 ...

  4. 使用telnet进行Dubbo接口测试

    telnet进入dubbo 查看pid $ jps -l 26048 org.apache.catalina.startup.Bootstrap 12388 org.jetbrains.jps.cmd ...

  5. vue-router使用 看着篇就够了

    官网地址:https://router.vuejs.org/zh/ 先来个自我介绍吧,我就是你们口中的路由,我的作用就是告诉你们怎么到达某地,比如你想去一个地方(前提是这个地方是已经存在的)我会查询我 ...

  6. TF-IDF 提取关键词

    <?php class Document { protected $words; protected $tf_matrix; protected $tfidf_matrix; public fu ...

  7. PHP工程师必备知识整理

    一.http/https协议,tcp/ip协议,websocket,session,cookie 二.php:oop,thinkphp5,laravel 三.mysql.memcache.redis ...

  8. Vue-admin工作整理(十七):Mock模拟Ajax请求

    思路:使用Mock拦截actions请求,通过 Mock.mock(/\/getUserInfo/, 'post', getUserInfo) 进行拦截标示,然后将内容返回 export const ...

  9. 从Scratch到Python——python turtle 一种比pygame更加简洁的实现

    从Scratch到Python--python turtle 一种比pygame更加简洁的实现 现在很多学校都开设了Scratch课程,学生可以利用Scratch创作丰富的作品,然而Scratch之后 ...

  10. webpack-工程化工具

    一.简介 1.webpack 是 facebook 公司发布的一款工程化工具,早期有 react 使用. 2.核心理念: 一切都是资源,是资源我们就能模块化打包加载. 3.webpack 默认支持 c ...