git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
git config --global --unset http.proxy
git config --global --get http.proxy
$ git config --global http.proxy http://proxyuser:proxypwd@proxy.server.com:8080
$ git config --system http.sslcainfo /bin/curl-ca-bundle.crt
$ git remote add origin https://mygithubuser:mygithubpwd@github.com/repoUser/repoName.git
$ git push origin master
用ProxyServer:Port
的值设置一个名为http_proxy
的系统变量。那是最简单的解决方案。分别使用https_proxy
在注释中指出的 https_proxy。
设置 gitproxy(如 sleske 所提到的)是另一种选择,但是它需要一个 “命令”,它不如上面的解决方案那么简单。
参考: http : //bardofschool.blogspot.com/2008/11/use-git-behind-proxy.html
[http]
proxy = http://username:password@proxy.at.your.org:8080
git -c "http.proxy=address:port" clone https://...
alias git-proxy='git -c "http.proxy=address:port"'
$ sudo apt-get install corkscrew
#!/bin/sh
exec corkscrew <name of proxy server> <port> $*
# <name_of_proxy_server> and <port> are the ip address and port of the server
# e.g. exec corkscrew 192.168.0.1 808 $*
$ chmod +x git-proxy.sh
$ export GIT_PROXY_COMMAND="/<path>/git-proxy.sh"
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git config --list --global --show-origin
[http]
proxy = http://YOUR_PROXY_USERNAME:YOUR_PROXY_PASSWORD@YOUR.PROXY.SERVER:YOUR.PROXY.SERVER.PORT
sslverify = false
[https]
proxy = http://YOUR_PROXY_USERNAME:YOUR_PROXY_PASSWORD@YOUR.PROXY.SERVER:YOUR.PROXY.SERVER.PORT
sslverify = false
[url "http://github.com/"]
insteadOf = git://github.com/
[user]
name = Arpit Aggarwal
email = aggarwalarpit.89@gmail.com
[http]
proxy = http://proxy:8080
[https]
proxy = http://proxy:8080
[url "https://"]
insteadOf = git://
#!/bin/sh
exec socat - socks4:your.company.com:$1:$2
git config --global http.proxy http://<proxy address>:<port number>
git clone git@github.com:<user name>/<project name>.git // will not use the http proxy