Search code examples
gitdnssocks5

How to configure git's sock5 proxy to use remote dns resolve


I configured the git proxy globally:

[https "https://github.com"]
    proxy = socks5://127.0.0.1:51837

However, when it was pushed to github, the connection was still abnormal. Through the opening log, I could see that although git uses socks proxy, it is resolved through the local dns, but the dns of github in my area was contaminated.

GIT_CURL_VERBOSE=1 GIT_TRACE=1 git push origin master

The problem has been solved by configuring the correct ip mapping in the hosts file. This should also be resolved by using a public dns.

But I still want to know how to configure the git socks proxy to use remote dns resolution?


Solution

  • socks5h will use remote dns resolve, for example:

    git --config 'http.proxy=socks5h://127.0.0.1:4444'

    from stackoverflow.com/a/63228830/7976758 comments

    Thanks @phd for the comment,