fatal: protocol error: bad pack header Git Origin: Build & delivery OSI layer 7 · Application Last updated 25 Nov 2026

fatal: protocol error: bad pack header

Git received garbage instead of a pack, from a proxy or broken server.

Exact message you may see fatal: protocol error: bad pack headerprotocol error bad line length
Seen on: Git

Meaning

A proxy/firewall/ssh banner can inject text. Check ~/.bashrc outputs on the SSH server (they corrupt the stream), proxies and try another protocol.

Common causes

  • Shell startup prints text on SSH server
  • Proxy injecting content
  • Server error

⚡ Quick fix

  1. Remove echo/output from remote shell profile
  2. Try HTTPS vs SSH
  3. Test without proxy

Detailed fix by platform

Shell

  1. ssh git@host true | wc -c # should output nothing

How to diagnose

  1. Remote shell — prints?
  2. Proxy — involved?
  3. Protocol — other works?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):

channel 2: open failed: administratively prohibited: open failed — channel 2: open failed: administratively prohibited: open failed (Linux)channel 2: open faile…Connection reset: kex_exchange_identification: banner line contains invalid characters — kex_exchange_identification: banner line contains invalid characters (Git)Connection reset: kex…early EOF — fatal: early EOF — fatal: index-pack failed (Git)early EOFerror: Could not read ... fatal: pack has bad object / index-pack failed — fatal: pack has bad object at offset 12345: inflate returned -3 (Git)error: Could not read…Failed to connect to github.com port 443: Timed out — fatal: unable to access 'https://github.com/org/repo.git/': Failed to connect to github.com port 443 after 21000 ms: Timed out (Git)Failed to connect to …fatal: Interactive git shell is not enabled — fatal: Interactive git shell is not enabled. hint: ~/git-shell-commands should exist and be executable. (Git)fatal: Interactive gi…fatal: pack-objects died of signal 9 / out of memory — error: pack-objects died of signal 9 fatal: the remote end hung up unexpectedly (Git)fatal: pack-objects d…git ignores NO_PROXY / proxy for specific host — fatal: unable to access: Could not resolve proxy: proxy.corp.example.com (Git)git ignores NO_PROXY …fatal: pr…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.