查看“︁Git/代理”︁的源代码
来自康健生活
←
Git/代理
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
== 标题文本 == 查看代理信息 {{shc|<syntaxhighlight lang="bash"> git config --global -l</syntaxhighlight>|$|/home/kangkk}} == 全局代理 == {{shc|<syntaxhighlight lang="bash"> git config --global http.proxy http://192.168.51.34:808 git config --global https.proxy https://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}} 取消代理 {{shc|<syntaxhighlight lang="bash"> git config --global --unset http.proxy git config --global --unset https.proxy</syntaxhighlight>|$|/home/kangkk}} === 代理服务器鉴权 === {{shc|<syntaxhighlight lang="bash"> git config --global https.proxy https://username:password@proxy.abc.com:808 </syntaxhighlight>|$|/home/kangkk}} 需要注意的是账号密码信息用 Percent-encoding(百分号编码) 编码格式转换,以避免特殊符号如 @ 等干扰命令字符串解析<ref>https://stackoverflow.com/questions/6172719/escape-character-in-git-proxy-password</ref>。 == 分流 == 只对特定仓库进行代理 {{shc|<syntaxhighlight lang="bash"> git config --global http.https://github.com.proxy http://192.168.51.34:808 git config --global https.https://github.com.proxy http://192.168.51.34:808</syntaxhighlight>|$|/home/kangkk}} 或者使用 socks {{shc|<syntaxhighlight lang="bash"> git config --global http.https://github.com.proxy socks5://192.168.51.34:1080 git config --global https.https://github.com.proxy socks5://192.168.51.34:1080</syntaxhighlight>|$|/home/kangkk}} == 配置文件 == {{hc|head=~/.gitconfig|output=<syntaxhighlight lang="bash"> [http] proxy = socks5://192.168.51.34:1080 proxy = http://192.168.51.34:1080 [https] proxy = socks5://192.168.51.34:1080 proxy = https://192.168.51.34:1080 </syntaxhighlight>}} {{shc|<syntaxhighlight lang="bash"> git config -l --global</syntaxhighlight>|$|/home/kangkk}}
此页面嵌入的页面:
模板:Hc
(
查看源代码
)
模板:Hc/style.css
(
查看源代码
)
模板:Linenum
(
查看源代码
)
模板:Linenum/style.css
(
查看源代码
)
模板:Shc
(
查看源代码
)
模板:Shc/style.css
(
查看源代码
)
模板:Shc out
(
查看源代码
)
模板:Shc out/style.css
(
查看源代码
)
返回
Git/代理
。
导航菜单
康健生活
搜索
user-page
通知
user-interface-preferences
个人工具
登录
五一
多读书,多运动,多到远处走走,再看看不一样的世界。