使用git clone的时候报错:Received HTTP code 503 from proxy after CONNECT

1 问题出现的原因

1.1 问题描述

我在使用git clone克隆某个项目的时候报错:Received HTTP code 503 from proxy after CONNECT,具体信息如下

zhihui@zhihui-desktop:~/yolov4-deepsort/checkpoints$ git clone https://github.com/onnx/tensorflow-onnx.git
Cloning into 'tensorflow-onnx'...
fatal: unable to access 'https://github.com/onnx/tensorflow-onnx.git/': Received HTTP code 503 from proxy after CONNECT
zhihui@zhihui-desktop:~/yolov4-deepsort/checkpoints$ git clone https://github.com.cnpmjs.org/onnx/tensorflow-onnx.git --config http.proxy= --config http.sslVerify=false
Cloning into 'tensorflow-onnx'...
remote: Enumerating objects: 79, done.
remote: Counting objects: 100% (79/79), done.
remote: Compressing objects: 100% (65/65), done.
remote: Total 10847 (delta 43), reused 35 (delta 14), pack-reused 10768
Receiving objects: 100% (10847/10847), 21.12 MiB | 1.88 MiB/s, done.
Resolving deltas: 100% (8096/8096), done.
zhihui@zhihui-desktop:~/yolov4-deepsort/checkpoints$ 

1.2 尝试解决问题

各种google、最后还尝试了百度,大多给出的解决方法都是类似,主要解决方法在这里

1、方法一:修改git的配置文件

vim ~/.gitconfig

然后添加如下信息:

[https]
    sslVerify = false
    proxy = https://proxy.corpadderess:8080
[http]
    sslVerify = false
    proxy = http://proxy.corpadderess:8080  

2、方法二:设置git参数

git clone <addr of repo> --config http.proxy= --config http.sslVerify=false

你们可以尝试,也许对你有用,只不过没有解决我的问题

2 解决错误:Received HTTP code 503 from proxy after CONNECT

2.1 我遇到这个错误的原因

后面我想到,我之前尝试安装vpn,在某个配置文件中添加了代理,这是我遇到这个问题的罪魁祸首(其实我的vpn也没

查看有没有使用代理

env | grep -I proxy

在这里插入图片描述

2.2 解决错误

解决这个错误就是要:取消我们设置代理(更多代理相关参考我的这篇博客

使用unset命令取消代理

$ unset https_proxy
$ unset http_proxy
$ unset ftp_proxy

在这里插入图片描述

2.3 彻底的根除这个错误,防止下次再遇到

我是在/etc/profile这个文件中添加的代理,最下面的三行是我添加的代理,删除即可!

zhihui@zhihui-desktop:~/onnx-tensorrt/build$ cat /etc/profile
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).

if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi



# 把下面自己添加的三行代理删除
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export ftp_proxy=http://127.0.0.1:8118

3 其他遇到同样错误的情况

以下的情况也都是由于这个代理导致的:

  • 1)使用pip安装库包,同样会报503错误
zhihui@zhihui-desktop:~/onnx-tensorrt/build$ pip install onnx==1.6.0 -i https://pypi.douban.com/simple
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.douban.com/simple
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 503 Forwarding failure',))': /simple/onnx/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 503 Forwarding failure',))': /simple/onnx/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 503 Forwarding failure',))': /simple/onnx/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 503 Forwarding failure',))': /simple/onnx/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 503 Forwarding failure',))': /simple/onnx/
ERROR: Could not find a version that satisfies the requirement onnx==1.6.0 (from versions: none)
ERROR: No matching distribution found for onnx==1.6.0
zhihui@zhihui-desktop:~/onnx-tensorrt/build$ git configg --global http:;roxy

  • 2)使用git submodule update下载子仓库也报同样的错误:Received HTTP code 503 from proxy after CONNECT
zhihui@zhihui-desktop:~/onnx-tensorrt$ git submodule update --init --recursive 
Submodule 'third_party/onnx' (https://github.com/onnx/onnx.git) registered for path 'third_party/onnx'
Cloning into '/home/zhihui/onnx-tensorrt/third_party/onnx'...
fatal: unable to access 'https://github.com/onnx/onnx.git/': Received HTTP code 503 from proxy after CONNECT
fatal: clone of 'https://github.com/onnx/onnx.git' into submodule path '/home/zhihui/onnx-tensorrt/third_party/onnx' failed
Failed to clone 'third_party/onnx'. Retry scheduled
Cloning into '/home/zhihui/onnx-tensorrt/third_party/onnx'...
fatal: unable to access 'https://github.com/onnx/onnx.git/': Received HTTP code 503 from proxy after CONNECT
fatal: clone of 'https://github.com/onnx/onnx.git' into submodule path '/home/zhihui/onnx-tensorrt/third_party/onnx' failed
Failed to clone 'third_party/onnx' a second time, aborting
zhihui@zhihui-desktop:~/onnx-tensorrt$ cd ..
已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 猿与汪的秘密 设计师:白松林 返回首页