Contents
GitHub Slow or Unreachable? Fixes That Actually Work
Why GitHub is slow and flaky in some regions (DNS interference, congested international links), the pros and cons of hosts-file and mirror workarounds, how to speed up git clone, releases and raw files, and how to fix SSH timeouts on port 22.
In some regions GitHub isn’t blocked outright, but it’s often painfully slow: pages crawl, images don’t load, and git clone drops to a few dozen KB/s or times out. There are two main causes — DNS interference on some GitHub domains and congested international links. Free workarounds like editing your hosts file or using mirrors help with some of it, but the reliable fix is to send GitHub traffic — including git in your terminal — over a stable overseas route, typically a VPN.
Why is GitHub so slow and inconsistent?
| Symptom | Usual cause |
|---|---|
| The page loads but avatars and README images don’t | Domains that serve images and raw files (raw.githubusercontent.com, avatars.githubusercontent.com) get bad DNS answers and can’t be reached |
| Fine during the day, sluggish at night | International links get congested in the evening, with heavy packet loss |
git clone is slow or drops halfway | Big transfers are most sensitive to link quality — packet loss makes TCP slow right down |
| SSH clones time out | Some networks restrict port 22 |
| Release downloads crawl | Release files live on separate domains such as objects.githubusercontent.com, which hit the same limits |
For why DNS and packet loss hurt so much, see Common network protocols explained.
Free workarounds and their trade-offs
Edit your hosts file or change DNS
Hard-code working IP addresses for GitHub’s domains in your hosts file, or switch to a public DNS resolver, to sidestep tampered DNS answers.
- Pros: free, and quick to fix “images won’t load”;
- Cons: GitHub’s IPs change, so shared hosts lists go stale fast — and it only fixes DNS, not slow links.
Mirrors and download proxies
Various GitHub mirrors and download-acceleration services let you swap in their URL to clone or download.
- Pros: very effective for cloning public repos and grabbing release files;
- Cons: third-party services can disappear at any time and may be out of date. Never sign in or use access tokens on them — pushing and opening PRs still has to go to GitHub itself.
Import via a local code host
Import the repo into a local code-hosting platform and clone from there. Fine for the occasional big download, but it’s fiddly, doesn’t stay in sync, and is no good for day-to-day collaboration.
When you need a stable overseas route
If you’re on GitHub every day — writing code, opening PRs, pulling dependencies — the workarounds above get old fast. The low-hassle option is to route all GitHub traffic over a stable overseas connection. The key is that your terminal has to use it too, not just the browser.
Why is the browser fast but git still slow?
Many tools only set a system proxy. Browsers honour it, but git, curl, npm and other command-line tools ignore it by default and still connect directly. Two ways to fix that:
Option 1: set a proxy for git (for tools that expose a local proxy port — use your tool’s port):
# Proxy only GitHub
git config --global http.https://github.com.proxy http://127.0.0.1:<port>
# Remove it again
git config --global --unset http.https://github.com.proxy
This only applies to HTTPS clones, not SSH.
Option 2: use TUN mode, where a virtual network adapter captures the whole device, so git, curl, docker and everything else work without per-tool settings. See System proxy vs TUN mode for the difference.
Speeding up GitHub with Pangolin
Pangolin uses TUN mode on every platform with Smart routing on by default: GitHub goes through the VPN automatically, while local package mirrors and your company network stay direct. Once you’re connected there’s nothing else to set up — git clone, git push and release downloads all use the fast route. If things slow down in the evening, tap refresh in the server list and pick a lower-latency server; see Connecting and switching servers.
Free plan limits: Pangolin’s free plan includes 10 minutes and 500 MB a day, which a big clone or download will use up quickly. For regular development you’ll want Pro — see Free plan limits.
Fixing SSH timeouts on port 22
If git clone [email protected]:... or ssh -T [email protected] keeps timing out, port 22 is probably restricted. GitHub runs an official SSH service on port 443. Edit ~/.ssh/config (create it if it doesn’t exist) and add:
Host github.com
Hostname ssh.github.com
Port 443
User git
Then test it:
ssh -T [email protected]
# "Hi <username>! You've successfully authenticated" means it worked
Your repository URLs stay the same — [email protected]:... now goes over port 443 automatically. This works alongside a VPN, too.
Faster releases and raw files
| What you’re downloading | Tip |
|---|---|
| Release installers | Download in the browser while connected; on the command line use curl -L -O <url>, which goes through the VPN automatically in TUN mode |
| A single raw file | Same as above; for the odd one-off, a mirror service also works |
| A big repo where you only need the latest code | git clone --depth 1 <repo> fetches just the latest commit — often a fraction of the size |
| A repo with large files (LFS) | Clone first, then git lfs pull; if it fails partway, retry — finished files are kept |
Related reading
FAQ
git clone over SSH keeps timing out — what can I do?
Many networks restrict port 22. GitHub runs an official SSH service on port 443 — in ~/.ssh/config, set github.com's Hostname to ssh.github.com and Port to 443. Your repository URLs don't need to change.
Are GitHub mirror sites safe to clone from?
For downloading public code they're generally fine, but they may lag behind the real repo, and you should never enter your GitHub password or tokens on a third-party mirror. Pushes still need to go to GitHub itself.
Why does my hosts-file fix stop working after a few days?
GitHub's IP addresses change, so the hosts lists passed around online go stale quickly. And a hosts file only fixes DNS interference — it does nothing for slow international links.
The VPN is on and the website loads, but git in my terminal is still slow — why?
Your tool probably only set a system proxy, which command-line tools ignore. Either configure a proxy for git specifically, or switch to TUN mode so the whole device is covered — Pangolin uses TUN by default.
Don't have Pangolin yet?
Available for iPhone / iPad, Mac, Windows and Android. New accounts get a free 7-day Pro trial.
Download the app