当前位置:   article > 正文

Git第七阶段:http/https proxy/ssh proxy/git proxy

Git第七阶段:http/https proxy/ssh proxy/git proxy

一、http proxy | https proxy
git config --global http.proxy http://proxy.bizerba.com:8080
git config --global https.proxy https://proxy.bizerba.com:8080

unset proxy:
git config --global --unset http.proxy
git config --global --unset https.proxy

二、ssh proxy(access your own git repo like git@github.com:user/yourrepo.git)
!!! generate ssh key, and upload public key to github,make you be able clone your repo like:
git clone git@github.com:user/yourrepo.git

but if you are behind a proxy , you need to:

windows 10:
在.ssh文件夹下面新建config文件,内容如下:

  1. Host github.com
  2. ProxyCommand connect -H user_ip:user_port %h %p
  3. ForwardAgent yes

linux:
在.ssh文件夹下面新建config文件,内容如下:

  1. Host github.com
  2. ProxyCommand nc -X connect -x your_ip:your_port %h %p
  3. ServerAliveInterval 10

三、git proxy( optional to access git repo like git@github.com:user/yourrepo.git )
# step1: download socat | oe-git-proxy |
$ sudo apt-get install socat
$ wget http://git.yoctoproject.org/cgit/cgit.cgi/poky/plain/scripts/oe-git-proxy
$ cp oe-git-proxy ~/bin
$ chmod +x ~/bin/oe-git-proxy

# step2: modify proxy env
sudo vim .profile
export http_proxy=http://proxy.bizerba.com:xxxx
export https_proxy=https://proxy.bizerba.com:xxxx
export ftp_proxy=http://proxy.bizerba.com:xxxx
#export ALL_PROXY=socks://proxy.bizerba.com:xxxx
#export all_proxy=socks://proxy.bizerba.com:xxxx
export no_proxy=http://proxy.bizerba.com:xxxx

export GIT_PROXY_COMMAND="oe-git-proxy"
export NO_PROXY=$no_proxy

# step3: login
su - username

# step4: modify git proxy setting
git config --global core.gitproxy ~/bin/oe-git-proxy

其他思路:
git config --global url."https://".insteadOf git://

参考文献:
CMS Offline Software
Working Behind a Network Proxy - Yocto Project

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/空白诗007/article/detail/913261
推荐阅读
相关标签
  

闽ICP备14008679号