转自 git clone出现 fatal: unable to access 'https://github.com/...'的解决办法(亲测有效) - 山村码农 - 博客园 (cnblogs.com)

<div id="cnblogs_post_body" class="blogpost-body cnblogs-markdown">
<p>转自:<a href="https://blog.csdn.net/dashi_lu/article/details/89641778" target="_blank" rel="noopener">https://blog.csdn.net/dashi_lu/article/details/89641778</a></p>
<pre highlighted="true"><code class="hljs language-verilog">
如下图所示,当我试图克隆别人的repo时,会发生这样的错误,当我从git:/而不是https:<span class="hljs-comment">//,克隆时,它工作得很好。</span>

&nbsp;发生这种情况是因为代理是在git中配置的。既然它是https代理(而不是http)git <span class="hljs-keyword">config</span> http<span class="hljs-variable">.proxy</span>和git <span class="hljs-keyword">config</span> --<span class="hljs-keyword">global</span> http<span class="hljs-variable">.proxy</span>也无济于事。

解决方案一&nbsp;
<span class="hljs-number">1</span>、看看你的git配置
git <span class="hljs-keyword">config</span> --<span class="hljs-keyword">global</span> -l

如果你没有任何与https代理相关的内容,例如https_proxy = ...问题不在这里。

如果您有与https代理相关的内容,请将其从〜/ <span class="hljs-variable">.gitconfig</span>文件中删除,然后重试。

<span class="hljs-number">2</span>、如果仍然不起作用,请取消设置环境变量&nbsp;
env|grep -i proxy &nbsp;

&nbsp;你应该有一行或几行https_proxy = ...

使用以下内容逐个取消设置:取消设置https_proxy(或HTTPS_PROXY,具体取决于变量的名称)

<span class="hljs-number">3</span>、再次检查环境变量
env|grep -i proxy &nbsp;

如果它没有显示任何你应该是好的。

注意:此解决方案可以应用于http和https代理问题。只是变量名称从https更改为http。

&nbsp;解决方案二
在开启shadowsock的前提下,手动配置git的代理。git客户端输入如下两个命令就可以了。

git <span class="hljs-keyword">config</span> --<span class="hljs-keyword">global</span> http<span class="hljs-variable">.proxy</span> http:<span class="hljs-comment">//127.0.0.1:1080</span>

git <span class="hljs-keyword">config</span> --<span class="hljs-keyword">global</span> https<span class="hljs-variable">.proxy</span> http:<span class="hljs-comment">//127.0.0.1:1080</span>

http:<span class="hljs-comment">//也可以改成sockets5://,但是区别在于:socks5不支持通过pubkey免密登录github,每次提交代码只能输入用户名和密码。http可以支持免密登录。</span>

取消代理:

git <span class="hljs-keyword">config</span> --<span class="hljs-keyword">global</span> --unset http<span class="hljs-variable">.proxy</span>&nbsp;

git <span class="hljs-keyword">config</span> --<span class="hljs-keyword">global</span> --unset https<span class="hljs-variable">.proxy</span>&nbsp;

其实方案一和方案二是同一种方法,不过方案二更加具体一点罢了,大部分问题都可以用方案二解决,当方案二无效时,考虑使用方案一。

</code></pre>

</div>

git clone 问题的更多相关文章

  1. git clone出现的error: The requested URL returned error: 401 Unauthorized

    error: The requested URL returned error: 401 Unauthorized while accessing https://git.oschina.net/.. ...

  2. git clone Linux 源码并切换TAG

    想从github上下载一个特定TAG分支来查看代码,按照先git clone后git checkout的方式,提示说有文件没有提交.因为只查看不编译运行,所以这些关系不大的文件采取删除或者重新命名后提 ...

  3. git clone时,报403错误,完美解决方案

    首先命令行操作结果如下: root@zhiren-PowerEdge-T110-II:/zrun# git clone https://git.coding.net/xxxxxxxx/xxxx.git ...

  4. git clone error: RPC failed; result=22, HTTP code = 502

    http://www.jianshu.com/p/645d3fe4e028 git克隆的工程太大用https的方式会有如下问题 hbl:tmp hubert$ git clone https://gi ...

  5. git clone带用户名和密码的方式

    git clone http://username:password@127.0.0.1/res/res.git

  6. git clone错误

    git clone错误 Initialized empty Git repository in ***/.git/ error: The requested URL returned error: 4 ...

  7. git clone google代码库

    git clone  https://chromium.googlesource.com/chromium/src 发现有将近7G,但是速度太慢,老是失败,提示信息先后是"The remot ...

  8. [译]git clone

    git clone git clone命令copy一个已经存在的Git仓储. git clone有点像svn的checkout, 他的不同之处是这个copy也是一个完整的仓储-它有自己的历史纪录, 能 ...

  9. git clone

    raw text for ssh: git@github.com:TommyU/avbot_config.git git command on linux: git clone git://githu ...

  10. 使用git建立远程仓库,让别人git clone下来

    首先, 如果你的ssh没有安装的话,要安装ssh服务端.ubuntu是很简单 sudo apt-get install openssh-server 1,建立你的git 目录. ourunix@ubu ...

随机推荐

  1. Python入门-第一行代码到多行代码

    不管学啥语言,开始的第一行代码都是: print("hello word") 回车之后,就代表你正式进入代码的世界! 如果报错,恭喜你获得第一个书写bug,请检查单词拼写,双引号, ...

  2. c++对c的拓展_函数的引用

    注意:1.引用可作为形参较指针更为直观 2可作为返回值 (判断标准:空间是否释放) #include <iostream> #include <stdlib.h> using ...

  3. mysql发展历程 各分支版本溯源

    首先为什么要了解mysql的历史,了解一个软件的前生后世有时候还是很有必要,特别是对于走在架构之路或者是想深入了解一个软件的时候,在不同版本中由于进行了很多的改进或者说加入了新的功能,也有可能是软件本 ...

  4. Codeforces Round #720 (Div. 2) B. Nastia and a Good Array(被坑好几次)1300

    原题链接 Problem - B - Codeforces 题意 给一串数,要把任意两个相邻的数的最大公约数=1 每次可以进行一个操作: 取下标为i, j的数,和任意二数x,y,且min(ai,aj) ...

  5. python基础练习题(题目 递归输出)

    day19 --------------------------------------------------------------- 实例027:递归输出 题目 利用递归函数调用方式,将所输入的 ...

  6. JS的URIencode方式

    BEGIN; 对需要传递的URL参数进行URLencode编码 刚开始浪费了很多时间都没搞出来,不知道怎么用.后面google到了不少解决方案,最终解决.转载下面内容: js对文字进行编码涉及3个函数 ...

  7. DBSCAN算法概念【聚类】

    不用设值K个簇的值 需要设置两个值:minPts和半径r的值 可视化展示 核心对象,传销组织头头 传销方式发展下线,在某一个子组织内,一个不是首领的人没有任何下线,就称这个人为''边界点'' 圈圈圈圈 ...

  8. keepalived安装及配置文件详解

    一个执着于技术的公众号 在上一篇文章中,我们对Keepalived进行了简单入门学习: Keepalived入门学习 今天我们继续学习Keepalived服务. 一.安装Keepalived服务 两种 ...

  9. 论文阅读 Dynamic Graph Representation Learning Via Self-Attention Networks

    4 Dynamic Graph Representation Learning Via Self-Attention Networks link:https://arxiv.org/abs/1812. ...

  10. muduo源码分析之Buffer

    这一次我们来分析下muduo中Buffer的作用,我们知道,当我们客户端向服务器发送数据时候,服务器就会读取我们发送的数据,然后进行一系列处理,然后再发送到其他地方,在这里我们想象一下最简单的Echo ...