@@ -798,6 +798,36 @@ $ git checkout --orphan <branch-name>
798
798
$ git show < branch-name> :< file-name>
799
799
```
800
800
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
+
801
831
### clone 最新一次提交
802
832
803
833
``` bash
@@ -847,34 +877,6 @@ git reset <file-name>
847
877
848
878
不添加参数,默认是 ` -mixed `
849
879
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
-
878
880
### 配置 SSH 协议代理
879
881
880
882
``` shell
0 commit comments