当前位置:   article > 正文

Git设置代理_git 配置socks

git 配置socks

git 设置代理

1 手动设置

# 为 git 设置: http 代理
git config --global http.proxy http://127.0.0.1:5002
git config --global https.proxy https://127.0.0.1:5002

# 为 git 设置: socket5 代理
git config --global http.proxy socks5://127.0.0.1:5002
git config --global https.proxy socks5://127.0.0.1:5002

# 取消代理
git config --global --unset http.proxy 
git config --global --unset https.proxy
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

2 脚本设置

#! /bin/bash
# path: ~/bin/set-proxy-git

if [[ $# -ne 1 ]]; then
	echo "usage: $0  <on/off>" >&2
	exit
fi

choices=$1

if [ ${choices} = "on" ]; then
	echo "git config --global http.proxy http://127.0.0.1:5002"
	echo "git config --global https.proxy https://127.0.0.1:5002"
fi

if [ ${choices} = "off" ]; then
	echo "git config --global --unset http.proxy"
	echo "git config --global --unset https.proxy"
fi
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

3 References

  1. SOCKS5代理是什么?
  2. http代理与sock5代理相比的差异
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/482616
推荐阅读
相关标签
  

闽ICP备14008679号