How to make git work to push commits to GitHub via tor?

跟風遠走 提交于 2019-12-03 02:42:58

Setting an HTTP or HTTPS proxy will not work, because Tor acts on port 9050 as a SOCKS proxy. What will work instead is the software socat with some settings inside your SSH config:

Host github
  HostName github.com
  IdentityFile /path/to/your/file
  User git
  ProxyCommand socat STDIO SOCKS4A:127.0.0.1:%h:%p,socksport=9050

Your SSH settings usually live in ~/.ssh/config. The configurations above tell SSH settings for the host github. It takes your input and directs it via socat through Tor.

Now you can do a git COMMAND ssh://github/USER/REPO and git will do your COMMAND via Tor.

It might be easier to install a VM as suggested, like Whonix (also on GitHub), which will:

  • take care of the Tor connection
  • allow you to use Git with GitHub without having to define any proxy.

Take a look at Tails OS and PIA. Both of these should keep you safe and free.

You used a wrong syntax, correct is:

git config http.proxy socks5://localhost:9150 # 9150 for TOR browser, 9050 for TOR service git config https.proxy socks5://localhost:9150

You could switch from httpsto sshand use the tor SOCKS proxy in this way:

export SOCKS_SERVER=localhost:9050
git clone ssh://github.com/user/repo

Note that you need credentials when using ssh!

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!