在終端中運行以下命令,將代理設(shè)置為您的代理服務(wù)器地址和端口號:
$ git config --global http.http://github.com.proxy '{http/socks5}://{your.proxy.server}:{port}'
$ git config --global https.https://github.com.proxy '{http/socks5}://{your.proxy.server}:{port}'
將 {your.proxy.server} 和 {port} 替換為您的代理服務(wù)器地址和端口號。
例如:
$ git config --global http.http://github.com.proxy 'socks5://127.0.0.1:1089'
$ git config --global https.https://github.com.proxy 'socks5://127.0.0.1:1089'
這樣配置的意圖:git默認(rèn)不走代理,github是例外走代理。