Answer a question

So, GitHub is now officially banned by Russian Government and Rospotrebnadzor. I used GitHub to create free software and share it, and it's important part of my life.

Today I've installed Tor on Arch Linux and now I'm able to browse GitHub and other banned sites. I tried to make git work via Tor but without success.

Here is what I did:

git config --global http.proxy localhost:9050
git config --global https.proxy localhost:9050

But when I try to push, I get error 501:

fatal: unable to access 'https://X@github.com/X/X.git/': Received HTTP code 501 from proxy after CONNECT

So, 501 means 'not implemented'. I have little experience with Tor (but from now on I'm starting to appreciate it), so don't know if it's really impossible to use Tor this way or I'm doing something wrong.

Q: how to configure git to use it via Tor?

Answers

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.

Logo

ModelScope旨在打造下一代开源的模型即服务共享平台,为泛AI开发者提供灵活、易用、低成本的一站式模型服务产品,让模型应用更简单!

更多推荐