2

torsocks git clone https://github.com/ElementsProject/lightning.git does not work and gives me:

Cloning into 'lightning'...
1643140279 PERROR torsocks[51452]: socks5 libc connect: Connection refused (in socks5_connect() at socks5.c:202)
fatal: unable to access 'https://github.com/ElementsProject/lightning.git/': Could not resolve host: github.com

as I'm using a custom TorSocks port I also tried torsocks -P <integer-not-to-be-doxxed> git clone https://github.com/ElementsProject/lightning.git and got

Cloning into 'lightning'...
remote: Enumerating objects: 84494, done.
remote: Counting objects: 100% (997/997), done.
remote: Compressing objects: 100% (529/529), done.
remote: Total 84494 (delta 581), reused 724 (delta 456), pack-reused 83497
Receiving objects: 100% (84494/84494), 44.87 MiB | 1.67 MiB/s, done.
Resolving deltas: 100% (64620/64620), done.
1643175331 ERROR torsocks[136753]: Unable to resolve. Status reply: 4 (in socks5_recv_resolve_reply() at socks5.c:677)

Comparing with the directory cloned without torsocks by running diff -r lightning /home/john/lightning gives me some differences in files whose importance is not known to me:

Binary files lightning/.git/index and /home/john/lightning/.git/index differ
diff -r lightning/.git/logs/HEAD /home/john/lightning/.git/logs/HEAD
1c1
< 0000000000000000000000000000000000000000 4dafeede5c81d1ba7626480083ad4bb6716a5f70 john <john@john-ONE-AMD-M4.(none)> 1643175525 +0100 clone: from https://github.com/ElementsProject/lightning.git
---
> 0000000000000000000000000000000000000000 4dafeede5c81d1ba7626480083ad4bb6716a5f70 john <john@john-ONE-AMD-M4.(none)> 1643175331 +0100 clone: from https://github.com/ElementsProject/lightning.git
diff -r lightning/.git/logs/refs/heads/master /home/john/lightning/.git/logs/refs/heads/master
1c1
< 0000000000000000000000000000000000000000 4dafeede5c81d1ba7626480083ad4bb6716a5f70 john <john@john-ONE-AMD-M4.(none)> 1643175525 +0100 clone: from https://github.com/ElementsProject/lightning.git
---
> 0000000000000000000000000000000000000000 4dafeede5c81d1ba7626480083ad4bb6716a5f70 john <john@john-ONE-AMD-M4.(none)> 1643175331 +0100 clone: from https://github.com/ElementsProject/lightning.git
diff -r lightning/.git/logs/refs/remotes/origin/HEAD /home/john/lightning/.git/logs/refs/remotes/origin/HEAD
1c1
< 0000000000000000000000000000000000000000 4dafeede5c81d1ba7626480083ad4bb6716a5f70 john <john@john-ONE-AMD-M4.(none)> 1643175525 +0100 clone: from https://github.com/ElementsProject/lightning.git
---
> 0000000000000000000000000000000000000000 4dafeede5c81d1ba7626480083ad4bb6716a5f70 john <john@john-ONE-AMD-M4.(none)> 1643175331 +0100 clone: from https://github.com/ElementsProject/lightning.git
Only in lightning/.git/objects/pack: pack-586d5b1c27e10e245ee727dce48e1417cb4d35c5.idx
Only in lightning/.git/objects/pack: pack-586d5b1c27e10e245ee727dce48e1417cb4d35c5.pack
Only in /home/john/lightning/.git/objects/pack: pack-e0c04dcbc0385bf98b24b9435bc415b19953ac10.idx
Only in /home/john/lightning/.git/objects/pack: pack-e0c04dcbc0385bf98b24b9435bc415b19953ac10.pack

It used to work some time ago, sadly not anymore. Why doesn't it work? How might I clone the repo over Tor?

4
  • @Prayank Appending VirtualAddrNetwork 192.168.0.0/16 in etc/tor/torrc has not helped. I'm using a nonstandard TorSocks port, specifying it with -P <integer> seems to help, I still get 1643175331 ERROR torsocks[136753]: Unable to resolve. Status reply: 4 (in socks5_recv_resolve_reply() at socks5.c:677), though.
    – John Smith
    Jan 26 at 5:51
  • Sorry I cannot help. Ask for help from Pieter Wuille or Moderators.
    – Prayank
    Jan 26 at 6:27
  • This is a question more about tor than it is about anything Bitcoin specific, so it will be migrated to the Tor stackexchange.
    – Andrew Chow
    Jan 27 at 3:18
  • 1
    I can successfully download that git repo using torsocks. Try running it with the --debug flag.
    – Steve
    Jan 28 at 5:39

1 Answer 1

2

It's how the Git works - you need to set Git socks proxy like that:

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

and to unset it: git config --global --unset http.proxy

Use http.proxy or https.proxy for names. That's good to make one-liner to make any nested calls for Git work, i.e. in a complex shell scripts, without touching a line.

And another workaround is using just for the one line is to use ALL_PROXY variable like that: ALL_PROXY=socks5://127.0.0.1:9050 git clone xxxxxx .

2
  • 1
    Thanks for the answer. I've set Git socks proxy with: git config --global https.proxy 'socks5://127.0.0.1:port-of-my-choice-not-to-be-doxxed' Now that it is configured, as evidenced in my ~/.gitconfig, may I skip the torsocks command when cloning the repo and will it still be cloned over tor? Like so git clone https://github.com/ElementsProject/lightning.git?
    – John Smith
    Feb 1 at 10:29
  • 2
    just one more thing to know: socks5 will resolve DNS through your local resolver, and socks5h in the protocol specification name will use remote resolver - just in case. Use the thing that fits your particular case. And - yes - as the proxy is set - no need to use neither torsocks, nor proxychains e.t.c. - it is already set in git's configuration files and used automatically. If you're about to use ALL_PROXY - keep in mind that some shell scripts and nested calls can fail and go directly.
    – Alexey Vesnin
    Feb 1 at 12:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.