转自 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-输入列表,求列表元素和(eval输入应用)

    在一行中输入列表,输出列表元素的和. 输入格式: 一行中输入列表. 输出格式: 在一行中输出列表元素的和. 输入样例: [3,8,-5] 输出样例: 6 代码: a = eval(input()) t ...

  2. RStudio中文乱码

    解决办法一: 1.设置RStudio文本显示的默认编码:RStudio菜单栏的Tools -> Global Options 2.code-->saving-->default te ...

  3. 将word文件转为excel文件

    有些word文件里的数据是有顺序或者规律,想转成表格的形式,下面就以我要转的word为例. 我的word文件是这样的 1.word转txt(文本文件) 文件--->另存为--->路径--- ...

  4. for 循环打印直角三角形、正三角形、棱形

    学习目标: 熟练掌握 for 循环的使用 例题: 1.需求:打印直角三角形 代码如下: // 左直角 for(int i = 0; i < 5; i++) { for(int j = 0; j ...

  5. 拼凑一个ABP VNext管理后台

    介绍 本项目前后端分离,后端采用ABP VNext框架,前端Vue. 项目地址: https://github.com/pojianbing/AuthCenter 目前包含的模块有: 身份认证管理 I ...

  6. Struts2-拦截器原理

    拦截器原理包含Aop思想和责任链模式 1.Aop思想 aop是面向切面编程,有基本功能,扩展功能,不通过修改源代码方式扩展功能.(动态代理) 2.责任链模式,Java有23种设计模式,责任链模式是其中 ...

  7. 自己写一个简单的LinkedList

    单链表 推荐阅读:https://www.cnblogs.com/zwtblog/tag/源码/ 哨兵节点: 哨兵节点在树和链表中被广泛用作伪头.伪尾等,通常不保存任何数据. 我们将使用伪头来简化我们 ...

  8. docker将jar打包镜像文件

    1.首先需要编写dockerfile文件,通过dockerfile文件将jar包打成镜像 编写dockerfile文件 # 定义父镜像 FROM java:8 # 维护者信息 MAINTAINER c ...

  9. petite-vue源码剖析-逐行解读@vue-reactivity之effect

    当我们通过effect将副函数向响应上下文注册后,副作用函数内访问响应式对象时即会自动收集依赖,并在相应的响应式属性发生变化后,自动触发副作用函数的执行. // ./effect.ts export ...

  10. netty系列之:netty中的核心MessageToByte编码器

    目录 简介 MessageToByte框架简介 MessageToByteEncoder ByteToMessageDecoder ByteToMessageCodec 总结 简介 之前的文章中,我们 ...