git proxy

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

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

手动修改~/.gitconfig

[http]
    proxy = "socks5::10800"
    cookiefile = ~/ssh/.gitcookies
[https]
    proxy = "socks5://:10800"

git push/fetch over ssh

Windows git bash

# ~/.ssh/config
Host github.com
    ProxyCommand connect -H 127.0.0.1:10809 -a none %h %p

Linux

# ~/.ssh/config
Host host.com
    HostName host.com
    User USER
    IdentityFile /home/USER/.ssh/id_rsa
    KexAlgorithms +diffie-hellman-group1-sha1
    ProxyCommand nc -x 127.0.0.1:10809 -Xconnect %h %p

Published

Category

Linux

Tags