如何在 Git 上配置 socks5 代理 [英] How to config socks5 proxy on Git

查看:122
本文介绍了如何在 Git 上配置 socks5 代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Linux 操作系统上通过代理下载 git 启动链接 (git://anongit.freedesktop.org/wayland/wayland) 时遇到问题.

我正在使用 Git 客户端 (http://git-scm.com/download/linux) 下载,我在.gitconfig文件中配置了http.proxy后就成功下载了http链接.

但是我已经尝试了很多方法来为git链接配置socks5代理,但都没有奏效.有人知道吗?

更多信息:

  1. 我需要使用 1080 端口的socks5 代理.

  2. 这个socks5代理有用户名和密码

解决方案

patthoyts将socks 代理与git 一起用于http 传输" 最终将在Git 2.7(2015 年12 月)中成为上游

参见 commit 6d7afe0(2015 年 10 月 26 日)Pat Thoyts (patthoyts).
(由 Jeff King -- peff -- 合并在 commit 92b9bf4,2015 年 12 月 1 日).

<块引用>

remote-http(s): 支持 SOCKS 代理

通过这个补丁,我们可以正确支持 SOCKS 代理,例如配置喜欢这个:

git config http.proxy socks5://192.168.67.1:32767

<块引用>

如果没有这个补丁,Git 会错误地尝试使用 SOCKS 代理,就好像它们是 HTTP 代理,导致如下错误消息:

fatal: 无法访问 'http://.../': Proxy CONNECT 中止

<块引用>

这个补丁需要在有故障的 AP 后面工作并从使用带有 git 的袜子代理进行 http 传输 并使用由 Johannes Schindelin 进行的适当的 cURL 版本检查.

I have problem with downloading the git start link (git://anongit.freedesktop.org/wayland/wayland) through a proxy on Linux OS.

I am using Git client (http://git-scm.com/download/linux) to download it, and it is successful to download the http link after I config the http.proxy in the .gitconfig file.

But I have tried a lot of ways to config the socks5 proxy for git link, but it didn't work. Does anyone know this?

More info on this:

  1. I need to use a socks5 proxy with 1080 port.

  2. There are username and password for this socks5 proxy

解决方案

The patch mentioned by patthoyts in "Using a socks proxy with git for the http transport" will finally make it upstream in Git 2.7 (Dec. 2015)

See commit 6d7afe0 (26 Oct 2015) by Pat Thoyts (patthoyts).
(Merged by Jeff King -- peff -- in commit 92b9bf4, 01 Dec 2015).

remote-http(s): support SOCKS proxies

With this patch we properly support SOCKS proxies, configured e.g. like this:

git config http.proxy socks5://192.168.67.1:32767

Without this patch, Git mistakenly tries to use SOCKS proxies as if they were HTTP proxies, resulting in a error message like:

fatal: unable to access 'http://.../': Proxy CONNECT aborted

This patch was required to work behind a faulty AP and scraped from Using a socks proxy with git for the http transport and guarded with an appropriate cURL version check by Johannes Schindelin.

这篇关于如何在 Git 上配置 socks5 代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆