目前通过配置
git config --global http.proxy 和
git config --global https.proxy
使得 http/https 协议 clone 时是走代理了,但是 ssh 还是直连。该如何设置呢?
1
Jaosn 2020 年 2 月 25 日
export https_proxy=http://127.0.0.1:8888;export http_proxy=http://127.0.0.1:8888;export all_proxy=socks5://127.0.0.1:8889
|
2
hguandl 2020 年 2 月 25 日
.ssh/config:
Host github.com ProxyCommand=nc -X 5 -x 127.0.0.1:1080 %h %p 如果全部都想走代理就把 Host github.com 换成 Host * 详见 https://gist.github.com/bynil/2126e374db8495fe33de2cbc543149ae |
3
ryougifujino OP @hguandl #2 你好,首先谢谢你的回答。但我配置之后为什么就提示这个了呢?没配置之前是可以的。
nc: read failed (0/3): Broken pipe ssh_exchange_identification: Connection closed by remote host fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. |
4
ryougifujino OP @hguandl #2 可以了,再次感谢。ProxyCommand=nc -X 5 -x 127.0.0.1:1080 %h %p,这句话实际上是指向的 socks5,而我 socks5 的端口是 1081,改了就可以了。
|
5
statement 2020 年 2 月 25 日 via iPhone
你给终端配一个代理不就行了
|
6
Smilencer 2020 年 2 月 25 日
# proxy
export http_proxy=socks5://127.0.0.1:10802 export https_proxy=$http_proxy |
7
CEBBCAT 2020 年 2 月 25 日
这个问题不简单,但也不是搜不到。
cat .ssh/config Host github.com HostName github.com User git # 走 HTTP 代理 # ProxyCommand socat - PROXY:127.0.0.1:%h:%p,proxyport=8080 # 走 socks5 代理(如 Shadowsocks ) ProxyCommand nc -v -x 127.0.0.1:1080 %h %p |
8
xiri 2020 年 2 月 25 日
你需要配置 ssh 代理
|
9
snowy0723 2020 年 2 月 26 日 via Android
再提供一个方法,用 proxychains.
|
10
Kobayashi 2020 年 2 月 26 日 via Android
Mellow,Surge 直接 TUN 无感知拦截。更狠的还有 Proxifier 内核模块拦截,代理。
|
11
hive 2020 年 2 月 27 日
@CEBBCAT #7
ProxyCommand nc -v -x 127.0.0.1:1080 %h %p ProxyCommand=nc -X 5 -x 127.0.0.1:1080 %h %p -v 和 -X 5 的区别是什么呢 |
12
hive 2020 年 2 月 27 日
|