转自 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. struts token令牌机制

    利用Struts同步令牌(Token)机制来解决Web应用中的重复提交问题.该方法的基本原理是:服务器端在处理到达的request之前,会将request中的Token值与保存在当前用户session ...

  2. Python使用函数模拟“汉诺塔”过程

    运行效果: 源代码: 1 # -*- coding:utf-8 -*- 2 ##汉诺塔游戏开始 3 _times=0 #用于统计移动次数 4 def hannuota(nlist,mfrom,mpas ...

  3. 动态div点击事件传递对象参数格式-草稿889

    <button type='button' style='border: 1px solid #eeeeee;color: #717070;height: 20px;border-radius: ...

  4. 微信小程序常用表单校验方法(手机号校验、身份证号(严格和非严格校验、验证码六位数字校验))

    util.js function isPhone(value) { if (!/^1(3|4|5|7|8)\d{9}$/.test(value)) { return false } else { re ...

  5. 在vue中实现点击哪个哪个区域变化背景色和字体颜色,其他默认(uni-app框架中也可以使用)

    template: 1 <view class="wrap"> 2 <view class="total" :class="{ se ...

  6. JS/TS项目里的Module都是什么?

    摘要:在日常进行JS/TS项目开发的时候,经常会遇到require某个依赖和module.exports来定义某个函数的情况.就很好奇Modules都代表什么和有什么作用呢. 本文分享自华为云社区&l ...

  7. 2021.08.16 P1363 幻象迷宫(dfs,我感受到了出题人浓浓的恶意)

    2021.08.16 P1363 幻象迷宫(dfs,我感受到了出题人浓浓的恶意) P1363 幻象迷宫 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 题意: 幻象迷宫可以认为是无限 ...

  8. 组合式应用新利器?SaaS新时代事件网格如何解决集成标准化问题

    摘要:组合式应用需要面临的一个难题是如何解决各个应用之间的集成标准问题,比如应用可能仅支持HTTP.TCP等协议中的一种,而缺乏统一的通讯标准就给业务落地该架构带来了困难.下面介绍事件网格(Event ...

  9. Elemnt ui 组件封装(table)

    <template> <div class="table"> <el-table :data="tableData2" :bord ...

  10. 观察者模式与Google Guava EventBus实现

    概述 观察者模式又被称为发布-订阅(Publish/Subscribe)模式,属于行为型模式的一种. 它定义了一种一对多的依赖关系,让多个观察者对象同时监听某一个主题对象.这个主题对象在状态变化时,会 ...