Git Network Errors Troubleshooting: From early EOF to RPC failed
Table of Contents (14 sections)
- 1. Golden Diagnostic Toolkit: Enabling Low-Level Git Tracing
- 2. Issue 1: fatal: early EOF & fatal: index-pack failed
- Root Cause
- Production-Grade Solutions
- 3. Issue 2: RPC failed; curl 56 Recv failure: Connection reset by peer
- Root Cause
- Production-Grade Solutions
- 4. Issue 3: GnuTLS recv error (-110): The TLS connection was non-properly terminated
- Root Cause
- Production-Grade Solutions
- 5. Issue 4: Failed to connect to github.com port 443: Connection timed out
- Root Cause
- Quick Fix
- 6. Diagnostic Matrix: Quick Reference
1. Golden Diagnostic Toolkit: Enabling Low-Level Git Tracing
By default, Git outputs only high-level summary messages when a fatal network error occurs, masking HTTP status codes, TLS handshake negotiations, and operating system socket states. Before debugging complex failures, enable verbose trace logs using standard environment variables:
# Inject tracing variables for a single clone command (leaves global config untouched)
GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 git clone https://github.com/org/repo.git
This prints raw cURL connections, TLS handshakes, and wire frames directly to your terminal:
* Connected to github.com (20.205.243.166) port 443 (#0)
* ALPN, offering h2, http/1.1
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* Recv failure: Connection reset by peer
2. Issue 1: fatal: early EOF & fatal: index-pack failed
error: RPC failed; result=18, HTTP code = 200
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Root Cause
This error typically strikes when downloading large Packfiles (often at 90%+ completion). The client expects a specified byte payload (e.g., 600MB), but before the stream completes, intermediate firewalls or upstream servers terminate the TCP connection, resulting in a premature EOF (End Of File). Because bytes are missing, Git’s index-pack validation fails and aborts the clone.
Production-Grade Solutions
- Option A (Immediate): Switch to shallow cloning via our streaming proxy:
git clone --depth 1 https://ghproxy.icu/https://github.com/org/repo.git - Option B (Memory Tuning): Adjust Git’s local memory window limits to prevent client-side buffer exhaustion:
git config --global core.packedGitLimit 512m git config --global core.packedGitWindowSize 512m git config --global pack.deltaCacheSize 2047m git config --global pack.packSizeLimit 2047m git config --global pack.windowMemory 2047m
3. Issue 2: RPC failed; curl 56 Recv failure: Connection reset by peer
error: RPC failed; curl 56 Recv failure: Connection reset by peer
fatal: the remote end hung up unexpectedly
Root Cause
- Cleartext SNI Filtering: Firewalls detect
github.comin the TLSClient Hellopacket and inject forged TCP RST packets; - MTU Path Blackholes: Jumbo frame packets exceeding intermediate network Path MTUs (e.g., > 1492 in PPPoE or VPN tunnels) get dropped without ICMP Fragmentation Needed notifications.
Production-Grade Solutions
- Route via Acceleration Doctor: The proxy terminates client TLS safely, shielding cleartext SNI from intermediate RST injection:
git clone https://ghproxy.icu/https://github.com/org/repo.git - Clamp Network MTU: Lower interface MTU to 1420 to prevent packet fragmentation drops:
# Linux sudo ip link set dev eth0 mtu 1420
4. Issue 3: GnuTLS recv error (-110): The TLS connection was non-properly terminated
fatal: unable to access 'https://github.com/org/repo.git/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Root Cause
Common on Debian/Ubuntu systems where Git is linked against libcurl-gnutls rather than OpenSSL. GnuTLS handles non-graceful TLS shutdown alerts (close_notify) strictly, triggering fatal exceptions when servers terminate keep-alive connections.
Production-Grade Solutions
- Option A: Reconfigure Git through
ghproxy.icuto bypass flaky direct connections; - Option B: Reinstall cURL with OpenSSL support:
sudo apt-get update sudo apt-get install -y git-core curl libcurl4-openssl-dev
5. Issue 4: Failed to connect to github.com port 443: Connection timed out
fatal: unable to access 'https://github.com/org/repo.git/': Failed to connect to github.com port 443 after 21082 ms: Connection timed out
Root Cause
- Local DNS poisoning has assigned an unreachable or blocked IP address;
- Stale Local Proxy Configurations: An earlier HTTP proxy setting (such as
127.0.0.1:7890) remains in~/.gitconfig, while the local proxy client is no longer running.
Quick Fix
# Check if stale proxies are configured in Git
git config --global --get http.proxy
git config --global --get https.proxy
# Clear stale proxies
git config --global --unset http.proxy
git config --global --unset https.proxy
# Route globally through GitHub Acceleration Doctor
git config --global url."https://ghproxy.icu/https://github.com/".insteadOf "https://github.com/"
6. Diagnostic Matrix: Quick Reference
| Error Signature | Primary Failure Layer | Rapid Triage Command |
|---|---|---|
OpenSSL SSL_read: Connection reset | TLS Handshake / SNI RST | Prefix with https://ghproxy.icu/ |
fatal: early EOF | TCP Packfile Interruption | Use --depth 1 shallow clone |
RPC failed; curl 56 | Path MTU / Network Drop | Set http.postBuffer 524288000 |
port 443: Connection timed out | Dead Proxy / DNS Poisoning | Clear http.proxy or route via proxy |
GnuTLS recv error (-110) | Client SSL Library Glitch | Switch to OpenSSL or proxy link |