From 6d602f3e898757b72bf4c518c24cc675112bd809 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Tue, 1 Nov 2022 16:35:25 +0800 Subject: [PATCH] doc: update `git.md`. --- docs/git.md | 58 +++++++++++++++++++++++++++-------------------------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/docs/git.md b/docs/git.md index 399b587..d94f967 100644 --- a/docs/git.md +++ b/docs/git.md @@ -798,6 +798,36 @@ $ git checkout --orphan $ git show : ``` +### 配置 http 和 socks 代理 + + +```bash +# 查看代理 +$ git config --global http.proxy +$ git config --global https.proxy +$ git config --global socks.proxy + +# 设置代理 +# 适用于 privoxy 将 socks 协议转为 http 协议的 http 端口 +$ git config --global http.proxy http://127.0.0.1:1080 +$ git config --global https.proxy http://127.0.0.1:1080 +$ git config --global socks.proxy 127.0.0.1:1080 + +# 取消代理 +$ git config --global --unset http.proxy +$ git config --global --unset https.proxy +$ git config --global --unset socks.proxy + +# 只对 github.com 设置代理 +$ git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 +$ git config --global https.https://github.com.proxy socks5://127.0.0.1:1080 + +# 取消 github.com 代理 +$ git config --global --unset http.https://github.com.proxy +$ git config --global --unset https.https://github.com.proxy +``` + + ### clone 最新一次提交 ```bash @@ -847,34 +877,6 @@ git reset 不添加参数,默认是 `-mixed` -### 配置 http 和 socks 代理 - -```bash -# 查看代理 -$ git config --global http.proxy -$ git config --global https.proxy -$ git config --global socks.proxy - -# 设置代理 -# 适用于 privoxy 将 socks 协议转为 http 协议的 http 端口 -$ git config --global http.proxy http://127.0.0.1:1080 -$ git config --global https.proxy http://127.0.0.1:1080 -$ git config --global socks.proxy 127.0.0.1:1080 - -# 取消代理 -$ git config --global --unset http.proxy -$ git config --global --unset https.proxy -$ git config --global --unset socks.proxy - -# 只对 github.com 设置代理 -$ git config --global http.https://github.com.proxy socks5://127.0.0.1:1080 -$ git config --global https.https://github.com.proxy socks5://127.0.0.1:1080 - -# 取消 github.com 代理 -$ git config --global --unset http.https://github.com.proxy -$ git config --global --unset https.https://github.com.proxy -``` - ### 配置 SSH 协议代理 ```shell