Who This Is For
This article is for people who can open GitHub in a browser, but git pull, git push, or git fetch are still painfully slow or frequently hang. You do not need deep networking knowledge before you begin. Follow the checks in order and you will usually be able to isolate the real bottleneck quickly.
What You Will Do
- Check whether your repository currently uses
HTTPSorSSH. - Switch to
HTTPSwhen you want the simplest proxy-friendly path. - Configure a local HTTP proxy for Git.
- Fall back to
SSH over 443when the HTTPS path is not enough. - Decide whether the real problem is repository size instead of network routing.
Before You Start
- Git is already installed locally.
- You already have a GitHub repository and can enter the local repository directory.
- Your proxy app is running and you know its local HTTP port.
Check that Git works:
git --version
If the terminal prints a Git version, the environment is ready.
First: Decide What Kind of “Slow” You Have
In practice, slow GitHub operations usually come from one of two causes:
- The network path is unstable.
- The repository itself is too large.
The first case is more common. It usually looks like git pull, git push, or git fetch spending a long time in the connection phase. The second case appears more often when the repository contains many binaries, models, images, videos, or a very heavy history.
This article handles the network-path problem first because that is the fastest win for most daily repositories.
Step 1: Check Whether the Remote Uses HTTPS or SSH
Enter your repository directory and run:
git remote -v
If you see a URL like this:
https://github.com/<your-name>/<your-repo>.git
your repository already uses HTTPS.
If you see a URL like this:
git@github.com:<your-name>/<your-repo>.git
your repository is using SSH.
This distinction matters because the easiest acceleration path for many users is to move to HTTPS first and then configure an HTTP proxy for Git.
Step 2: If You Use SSH, Switch to HTTPS First
GitHub’s own documentation notes that HTTPS fits proxy and firewall-constrained environments more naturally. If your main problem is poor connectivity or unstable speed, switching to HTTPS first usually makes troubleshooting easier.
On the GitHub repository page, click the green Code button, switch to the HTTPS tab, and copy the remote URL.

Then run:
git remote set-url origin https://github.com/<your-name>/<your-repo>.git
Verify it:
git remote -v
If the output now shows https://github.com/..., this step worked.
[!tip] If GitHub asks for authentication later during
push, a Personal Access Token or your local credential manager is normal for HTTPS. That does not mean the configuration is broken.
Step 3: Find Your Local Proxy Port
Git needs a concrete local HTTP proxy address, so you need the port that your proxy app is currently listening on.
In your screenshot, the port is 7890:

If your machine uses a different port, replace 7890 in the commands below with your own value.
Step 4: Configure the Git Proxy
Now configure Git:
git config --global http.proxy http://127.0.0.1:7890
Then verify the value immediately:
git config --global --get http.proxy
If the terminal prints:
http://127.0.0.1:7890
Git is now sending HTTP-based remote traffic through your local proxy.
Step 5: Test Pull and Push Again
Return to the repository directory and test:
git fetch
git pull
git push
If you want a quick read-only check first, run:
git ls-remote origin
Use these rules to judge the result:
- If the commands are clearly faster, the bottleneck was mostly the network path.
- If
fetchandpullimprove butpushis still slow, start checking whether the repository is too large. - If nothing really improves, continue to the fallback options below.
Step 6: Try SSH over Port 443
Some networks restrict the default SSH port 22. GitHub provides ssh.github.com:443 as a compatibility path for users who want to keep SSH but need a more reliable route.
Add this block to ~/.ssh/config:
Host github.com
Hostname ssh.github.com
Port 443
User git
Then test the connection:
ssh -T git@github.com
If you see a GitHub authentication or welcome message, the route is working.
Show Explanation
When to Prefer HTTPS vs SSH over 443
- If you mainly want the quickest way to speed up
pullandpush, try HTTPS plus a local proxy first. - If you already rely on SSH and do not want to change the remote URL long term, try SSH over 443 next.
- In restricted networks such as offices or campuses, the default SSH port
22is often blocked more aggressively than HTTPS-style traffic.
```
Step 7: Check Whether the Repository Is Simply Too Large
If the network path is already improved but push is still slow, the next suspect is repository size.
Check the object size summary:
git count-objects -vH
Then look for obviously large files in the working tree:
find . -type f -size +50M
This step helps you separate the problem correctly:
- If the slowdown comes from routing, the proxy steps usually help immediately.
- If the slowdown comes from large files, you need to reduce transfer size instead of only changing network settings.
Step 8: Use the Right Strategy for Large Repositories
Option A: Move Large Files to Git LFS
If your repository must contain models, archives, large images, or other heavy binaries, Git LFS is usually better than storing those files directly in normal Git history.
git lfs install
git lfs track "*.zip"
git add .gitattributes
git add <your-large-file>
git commit -m "chore: track large files with Git LFS"
git push
This makes future transfers more suitable for large-file workflows.
Option B: Reduce Data When You Clone
If you are cloning a large repository for the first time, do not assume you need every file and every commit right away.
git clone --depth 1 --filter=blob:none https://github.com/<your-name>/<your-repo>.git
Why this helps:
--depth 1downloads only the latest commit history layer.--filter=blob:nonereduces the file-object payload during the initial clone.
Show Explanation
When You Need Only Part of a Repository
If your repository is very large but you only work inside one or two directories, sparse-checkout can help:
```bash git clone --sparse https://github.com/<your-name>/<your-repo>.git cd <your-repo> git sparse-checkout set <dir1> <dir2> ```
This approach is most useful when you are cloning a large repository for the first time, not when you already have a long-lived local checkout.
```
How to Confirm It Worked
git remote -vshows the protocol path you intended to use.git config --global --get http.proxyprints the correct local proxy address.git fetchorgit pullis clearly faster than before.git pushno longer hangs for a long time in the connection phase.- If the problem was repository size, you already moved to Git LFS or a lighter clone strategy.
If the first three or four checks now pass, you have usually resolved the main bottleneck.
Common Questions
Do I need to keep the proxy forever?
Not necessarily. If you only need the proxy in one network environment, remove it afterward:
git config --global --unset http.proxy
If you also set https.proxy, remove that one too.
Why is HTTPS still slow after I switched?
That usually means the problem is not only the protocol itself. Common causes include:
- the local proxy is not actually running
- the configured port is wrong
- the current network also restricts the proxy path
- the repository contains large files or a heavy history
Go back and verify Steps 3 through 7 before you start changing random Git settings.
Should I blindly edit hosts or copy random Git tweaks?
Usually no. Random hosts edits, outdated buffer tweaks, or unknown mirrors often make troubleshooting harder instead of easier. For most personal repositories, checking the protocol, the proxy path, and the repository size already solves the majority of cases.
References
- GitHub Docs: About remote repositories
- GitHub Docs: Using SSH over the HTTPS port
- GitHub Docs: About large files on GitHub
- GitHub Docs: About Git Large File Storage
- Git Docs: git-config
- Git Docs: partial clone
- Git Docs: git-sparse-checkout
Review Score
Score: 94/100 Verdict: This is a complete, reproducible draft that is ready for human review before publishing.
Show Explanation
Score Breakdown
- Accuracy: 24/25. The primary path uses HTTPS plus a local proxy and stays aligned with the screenshots and official documentation.
- Beginner friendliness: 24/25. Each step explains both why it matters and how to verify the result.
- Reproducibility: 24/25. The commands, validation checks, rollback step, and port replacement rule are explicit.
- Professional judgment and risk handling: 22/25. Risky or low-signal fixes are avoided as defaults, but a final manual publish pass should still confirm your exact proxy app and screenshots.
Review Notes
- This draft is complete enough for human review.
- Before publishing, add one final screenshot that shows how to unset the proxy and return to the default state.
```
Personnel
- ✍ Creator: Chenglin Cai
- 🤖 AI Collaboration: ChatGPT
- 🧪 Data Provider: Chenglin Cai
- 💻 Code Contributor: ChatGPT