go get 無反應方法 Win/Linux 命令行、終端和 Git 代理設置


go get -u -v 無反應方法

CMD要用管理員權限運行,否則設置無效

netsh winhttp set proxy proxy-server="https=127.0.0.1:1080" bypass-list="localhost"

查看當前CMD正在使用的代理

netsh winhttp show proxy

清空CMD使用的代理

netsh winhttp reset proxy

 

還有一種方式

set http_proxy=http://127.0.0.1:1080 set https_proxy=http://127.0.0.1:1080

別問我為毛要使用代理,TMD試一試

 go get -u -v github.com/astaxie/beego

凸(艹皿艹 ),搞個計算機學習都很蛋疼

下面是我設置的hosts,各位童鞋可以用IP查找工具來獲取IP地址設置hosts,速度杠杠的

    vim /etc/hosts
    192.30.253.112 github.com
    151.101.185.194 github.global.ssl.fastly.net

 ===================== ===================== 騷氣的分割線===================== ===================== =====================

本文整理了 Windows 命令行 和 Linux 終端以及 Git 中設置代理的命令。以本地 HTTP/HTTPS 代理 127.0.0.1:8118 和 SOCKS5 代理 127.0.0.1:1080 為例。

Windows 命令行代理設置

HTTP 代理設置:

set http_proxy=http://127.0.0.1:8118
set https_proxy=http://127.0.0.1:8118

 

SOCKS5 代理設置:

set http_proxy=socks5://127.0.0.1:1080
set https_proxy=socks5://127.0.0.1:1080

取消代理設置:可以通過 echo %http_proxy% 命令查看是否設置成功。

set http_proxy=
set https_proxy=

 

Linux 終端代理設置

臨時代理設置

Linux 終端設置 HTTP 代理(只對當前終端有效):

1
2
$ export http_proxy=http://127.0.0.1:8118
$ export https_proxy=http://127.0.0.1:8118

 

Linux 中設置 SOCKS5 代理(只對當前終端有效):

1
2
$ export http_proxy=socks5://127.0.0.1:1080
$ export https_proxy=socks5://127.0.0.1:1080

 

設置終端中的 wget、curl 等都走 SOCKS5 代理(只對當前終端有效):

1
$ export ALL_PROXY=socks5://127.0.0.1:1080

 

Linux 終端中取消代理設置:

1
2
3
$ unset http_proxy
$ unset https_proxy
$ unset ALL_RPOXY

 

永久代理設置

將代理命令寫入配置文件 ~/.profile 或 ~/.bashrc 或 ~/.zshrc 中:

1
2
3
# HTTP 代理設置
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118

 

1
2
3
# SOCKS5 代理設置
export http_proxy=socks5://127.0.0.1:1080
export https_proxy=socks5://127.0.0.1:1080

 

1
2
# 強制終端中的 wget、curl 等都走 SOCKS5 代理
export ALL_PROXY=socks5://127.0.0.1:1080

 

Git 設置代理

代理格式 [protocol://][user[:password]@]proxyhost[:port]
參考 https://git-scm.com/docs/git-config

設置 HTTP 代理:

1
2
git config --global http.proxy http://127.0.0.1:8118
git config --global https.proxy http://127.0.0.1:8118

 

設置 SOCKS5 代理:

1
2
git config --global http.proxy socks5://127.0.0.1:1080
git config --global https.proxy socks5://127.0.0.1:1080

 

Git 取消代理設置:

1
2
git config --global --unset http.proxy
git config --global --unset https.proxy

 

 
 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM