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.
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
Take a look at Tails OS and PIA. Both of these should keep you safe and free.
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!
It might be easier to install a VM as suggested, like Whonix (also on GitHub), which will:
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.