Git/代理:修订间差异

来自康健生活
Kangkk​(留言 | 贡献)
Kangkk​(留言 | 贡献)
第11行: 第11行:
git config --global http.proxy 'socks5://192.168.51.34:808'
git config --global http.proxy 'socks5://192.168.51.34:808'
git config --global https.proxy 'socks5://192.168.51.34:808'</syntaxhighlight>|$|/home/kangkk}}
git config --global https.proxy 'socks5://192.168.51.34:808'</syntaxhighlight>|$|/home/kangkk}}
参考
{| class="wikitable"
|-
! Git协议 !! 代理协议 !! 配置文件 !! 配置
|-
| HTTP(s) || HTTP || <nowiki>~/.gitconfig</nowiki> || {{shc|<syntaxhighlight lang="bash">
git config --global http.proxy http://127.0.0.1:1080</syntaxhighlight>|$|/home/kangkk}}
|-
| HTTP(s) || SOCKS || <nowiki>~/.gitconfig</nowiki> || {{shc|<syntaxhighlight lang="bash">
git config --global http.proxy socks5h://127.0.0.1:1080</syntaxhighlight>|$|/home/kangkk}}
|-
| SSH || HTTP || <nowiki>~/.ssh/config</nowiki> || {{shc|<syntaxhighlight lang="bash">
Host github.com
  ProxyCommand nc -v -X connect -x 127.0.0.1:1080 %h %p</syntaxhighlight>|$|/home/kangkk}}
|-
| SSH || SOCKS || <nowiki>~/.ssh/config</nowiki> || {{shc|<syntaxhighlight lang="bash">
Host github.com
  ProxyCommand nc -v -X 5 -x 127.0.0.1:1080 %h %p</syntaxhighlight>|$|/home/kangkk}}
|}


取消代理
取消代理
第24行: 第45行:


需要注意的是账号密码信息用 Percent-encoding(百分号编码) 编码格式转换,以避免特殊符号如 @ 等干扰命令字符串解析<ref>https://stackoverflow.com/questions/6172719/escape-character-in-git-proxy-password</ref>。
需要注意的是账号密码信息用 Percent-encoding(百分号编码) 编码格式转换,以避免特殊符号如 @ 等干扰命令字符串解析<ref>https://stackoverflow.com/questions/6172719/escape-character-in-git-proxy-password</ref>。
== 分流 ==
== 分流 ==
只对特定仓库进行代理
只对特定仓库进行代理