Skip to content

Commit 6d602f3

Browse files
committed
doc: update git.md.
1 parent ff9d38d commit 6d602f3

File tree

1 file changed

+30
-28
lines changed

1 file changed

+30
-28
lines changed

docs/git.md

+30-28
Original file line numberDiff line numberDiff line change
@@ -798,6 +798,36 @@ $ git checkout --orphan <branch-name>
798798
$ git show <branch-name>:<file-name>
799799
```
800800

801+
### 配置 http 和 socks 代理
802+
<!--rehype:wrap-class=row-span-4-->
803+
804+
```bash
805+
# 查看代理
806+
$ git config --global http.proxy
807+
$ git config --global https.proxy
808+
$ git config --global socks.proxy
809+
810+
# 设置代理
811+
# 适用于 privoxy 将 socks 协议转为 http 协议的 http 端口
812+
$ git config --global http.proxy http://127.0.0.1:1080
813+
$ git config --global https.proxy http://127.0.0.1:1080
814+
$ git config --global socks.proxy 127.0.0.1:1080
815+
816+
# 取消代理
817+
$ git config --global --unset http.proxy
818+
$ git config --global --unset https.proxy
819+
$ git config --global --unset socks.proxy
820+
821+
# 只对 github.com 设置代理
822+
$ git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
823+
$ git config --global https.https://github.com.proxy socks5://127.0.0.1:1080
824+
825+
# 取消 github.com 代理
826+
$ git config --global --unset http.https://github.com.proxy
827+
$ git config --global --unset https.https://github.com.proxy
828+
```
829+
830+
801831
### clone 最新一次提交
802832

803833
```bash
@@ -847,34 +877,6 @@ git reset <file-name>
847877

848878
不添加参数,默认是 `-mixed`
849879

850-
### 配置 http 和 socks 代理
851-
852-
```bash
853-
# 查看代理
854-
$ git config --global http.proxy
855-
$ git config --global https.proxy
856-
$ git config --global socks.proxy
857-
858-
# 设置代理
859-
# 适用于 privoxy 将 socks 协议转为 http 协议的 http 端口
860-
$ git config --global http.proxy http://127.0.0.1:1080
861-
$ git config --global https.proxy http://127.0.0.1:1080
862-
$ git config --global socks.proxy 127.0.0.1:1080
863-
864-
# 取消代理
865-
$ git config --global --unset http.proxy
866-
$ git config --global --unset https.proxy
867-
$ git config --global --unset socks.proxy
868-
869-
# 只对 github.com 设置代理
870-
$ git config --global http.https://github.com.proxy socks5://127.0.0.1:1080
871-
$ git config --global https.https://github.com.proxy socks5://127.0.0.1:1080
872-
873-
# 取消 github.com 代理
874-
$ git config --global --unset http.https://github.com.proxy
875-
$ git config --global --unset https.https://github.com.proxy
876-
```
877-
878880
### 配置 SSH 协议代理
879881

880882
```shell

0 commit comments

Comments
 (0)