| Cause | Quick Fix |
|---|---|
| Network/Proxy Issues | Unset proxy or check connection |
| Large Repository Size | Increase http.postBuffer |
| SSL/SSH Handshake Failure | Switch from SSH to HTTPS (or vice versa) |
| Slow DNS/IPv6 Problems | Force IPv4 resolve |

What is Git Clone Stuck at 0%?
The “git clone stuck at 0%” error is a common networking or configuration issue where the Git client initiates a connection to a remote server but fails to begin receiving data objects. It typically manifests as a frozen terminal window with no progress in the “Receiving objects” phase.
This hang usually occurs because of an underlying bottleneck in the transport layer. Common culprits include restrictive firewalls, misconfigured global proxies, or a Git buffer size that is too small to handle large initial metadata transfers from the server.
Step-by-Step Solutions
1. Increase the Git Post Buffer Size
If you are cloning a large repository, the default buffer might be insufficient. Increasing the http.postBuffer helps Git manage larger chunks of data during the initial handshake.
git config --global http.postBuffer 524288000
2. Disable Git Global Proxies
If you previously configured a proxy for a specific network and forgot to unset it, Git may attempt to route traffic through a non-existent gateway, causing it to hang at 0%.
git config --global --unset http.proxy
git config --global --unset https.proxy
3. Use a Shallow Clone
To bypass issues with massive commit histories, try a shallow clone. This downloads only the latest snapshot of the repository, significantly reducing the initial data transfer requirement.
git clone --depth 1 [repository-url]
4. Force IPv4 Resolution
Sometimes the Git hang is caused by the system attempting to resolve the GitHub or GitLab address via IPv6, which may be slow or blocked on your network. Forcing IPv4 often resolves the timeout.
git config --global core.gitProxy "none"
# Alternatively, check your /etc/hosts file to ensure resolution is correct.
5. Switch Protocol (SSH vs HTTPS)
If HTTPS is failing due to SSL certificate issues, try cloning via SSH. Conversely, if SSH is blocked by a corporate firewall, switch to the HTTPS URL.
# Try SSH if HTTPS fails
git clone [email protected]:username/repo.git
# Try HTTPS if SSH fails
git clone https://github.com/username/repo.git
6. Debug the Connection
If the clone still hangs, use Git’s verbose logging to identify exactly where the connection is dropping. This will show if the hang is happening during the SSL handshake or the object enumeration phase.
export GIT_TRACE=1
export GIT_CURL_VERBOSE=1
git clone [repository-url]