linux, git, go get, dept_tools 代理设置

linux 设置代理

# 设置环境变量 
# 其实不写入 /etc/profile 或 ~/.bash_profile
# 和设置临时变量没什么区别
export http_proxy=http://127.0.0.1:8100
export https_proxy=http://127.0.0.1:8100

# 查看
echo $http_proxy
echo $https_proxy

# 取消代理
unset http_proxy
unset https_proxy

git 设置代理

git 代理会先检查有无系统代理,如果系统配置了 http_proxy / https_proxy,git 也会使用代理配置。

# 设置ss
git config --global http.proxy 'socks5://127.0.0.1:8100'
git config --global https.proxy 'socks5://127.0.0.1:8100'

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

# 取消代理
git config --global --unset http.proxy
git config --global --unset https.proxy

go get 设置代理

go get 使用的拉取工具就是 git,所以设置 git 的代理即可。

dept_tools 代理设置

dept_tools 是 google 的依赖管理工具,fetch 命令实质是调用的 python 拉取依赖,所以 dept_tools 的代理应使用 boto.cfg 配置。

# /etc/boto.cfg
[Boto]
debug = 1
num_retries = 2

# 代理 ip / 端口 (这是我的本地代理)
proxy = 127.0.0.1
proxy_port = 8100

image.png

win 环境变量

windows 设置,查看,删除环境变量

#设置
set CGO_ENABLE=0
set GO_ARCH=amd64

# 查看
set CGO_ENABLE
set GO_ARCH

# 删除
set CGO_ENABLE=
set GO_ARCH=

# 设置 PATH
set PATH=%PATH%;c:/bin/hello

你可能感兴趣的:(环境变量)