Note: How to Set a Proxy for GitHub Desktop

Published on

Original language: Chinese . AI translations: English , Japanese .


Background

When I cloned projects with GitHub Desktop, I only got a few tens of KB/s. A 30 MB repo took forever.
So I started looking for a solution. I thought it would be simple, but it took way longer than expected.

So I’m writing it down.


  • First I checked GitHub Desktop settings. Nothing.

  • I searched online in English first. I found a few methods, but they were all about http/https proxies: How Can I Configure GitHub Desktop/Windows to Work with a Proxy?
    What I needed was a SOCKS5 proxy. Not exactly the same, but I tried random settings anyway. Didn’t work.

  • More random attempts: replace http with socks, then run:

    git config —global socks.proxy socks://127.0.0.1:1080
    git config —global socks.proxy socks5://127.0.0.1:1080
    git config —global socks5.proxy socks://127.0.0.1:1080
    git config —global socks5.proxy socks5://127.0.0.1:1080

  • None of those worked.

  • It’s actually very simple, but I’m too much of a noob…

  • Then it clicked: people abroad usually need proxies inside corporate intranets, which is a different situation. I should have searched for Chinese tutorials.

  • Sure enough, there were plenty.

  • I found this: X先生说:通过 SS 代理加快 GitHub Clone 速度

    • In the first black box: http://127.0.0.1:1080
    • Turns out that’s all you need. Tears of no skill.

My Solution

Open C:\\Users\\username\\.gitconfig, and add:

[http]
proxy = http://127.0.0.1:1080

Then GitHub Desktop will use your local proxy.


08/18 update
I ran into another issue a couple days ago: cloning git:// didn’t work. After half a day of trial and error, my config is now:

[http]
proxy = socks5://127.0.0.1:1080
[https]
proxy = socks5://127.0.0.1:1080
[git]
proxy = socks5://127.0.0.1:1080

(again, tears of no skill)


References

Comments