|
| 1 | +--- |
| 2 | +title: "Fixing Git Clone Error: RPC Failed, HTTP/2 Stream Cancelled" |
| 3 | +authors: [ajay-dhangar] |
| 4 | +tags: ["Git", "GitHub", "Errors", "Cloning Repositories", "Fixes"] |
| 5 | +date: 2025-09-04 10:00:00 |
| 6 | +description: "How to fix the 'RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)' error when cloning large Git repositories." |
| 7 | +draft: false |
| 8 | +--- |
| 9 | + |
| 10 | +In this post, I’ll show you how to fix the frustrating `RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)` error that can occur when cloning large Git repositories. If you've encountered this error, you're not alone! Let's dive into the causes and solutions. |
| 11 | + |
| 12 | +<!-- truncate --> |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | +## Introduction |
| 17 | + |
| 18 | +The other day, I was trying to clone my GitHub repository, but I ran into a frustrating error. |
| 19 | +If you’ve ever seen something like this, you know how annoying it feels: |
| 20 | + |
| 21 | +```bash |
| 22 | +error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8) |
| 23 | +error: 3547 bytes of body are still expected |
| 24 | +fetch-pack: unexpected disconnect while reading sideband packet |
| 25 | +fatal: early EOF |
| 26 | +fatal: fetch-pack: invalid index-pack output |
| 27 | +```` |
| 28 | + |
| 29 | +At first, I thought something was wrong with my Git setup. But after digging in, I realized the problem was with **large repository size, network limits, and Git’s default settings**. |
| 30 | + |
| 31 | +In this blog, I’ll break down **why this happens** and the **step-by-step solutions** I tried to fix it. |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## Why This Error Happens |
| 36 | + |
| 37 | +This error usually shows up when: |
| 38 | +- Your repository is **very large** (hundreds of MBs or more). |
| 39 | +- Git’s default **HTTP buffer size is too small**. |
| 40 | +- The repo has **too many objects (commits, files, branches, blobs)**. |
| 41 | +- Network interruptions cause Git to cancel the fetch. |
| 42 | + |
| 43 | +Basically, Git starts downloading your repo, but before finishing, the connection breaks — and Git doesn’t know what to do with the incomplete data. |
| 44 | + |
| 45 | +--- |
| 46 | + |
| 47 | +## Solutions That Worked |
| 48 | + |
| 49 | +Here are the methods I tried to fix it: |
| 50 | + |
| 51 | +### 1. Increase Git Buffer Size |
| 52 | +Git’s default HTTP buffer is small. Let’s make it bigger: |
| 53 | + |
| 54 | +```bash |
| 55 | +git config --global http.postBuffer 524288000 |
| 56 | +git config --global http.maxRequests 100 |
| 57 | +git config --global http.version HTTP/1.1 |
| 58 | +``` |
| 59 | + |
| 60 | +This allows Git to handle bigger repositories without choking. |
| 61 | + |
| 62 | +--- |
| 63 | + |
| 64 | +### 2. Use a Shallow Clone (Fastest Fix) |
| 65 | + |
| 66 | +If you only need the latest commit (not the full history): |
| 67 | + |
| 68 | +```bash |
| 69 | +git clone --depth=1 https://github.com/ajay-dhangar/ajay-dhangar.github.io.git |
| 70 | +``` |
| 71 | + |
| 72 | +👉 This grabs the newest version quickly. |
| 73 | +If you later need full history: |
| 74 | + |
| 75 | +```bash |
| 76 | +cd ajay-dhangar.github.io |
| 77 | +git fetch --unshallow |
| 78 | +``` |
| 79 | + |
| 80 | +This way, you start small and expand as needed. |
| 81 | + |
| 82 | +--- |
| 83 | + |
| 84 | +### 3. Clone Only One Branch |
| 85 | + |
| 86 | +If the repo has multiple branches, but you just want `main`: |
| 87 | + |
| 88 | +```bash |
| 89 | +git clone --single-branch --branch main https://github.com/ajay-dhangar/ajay-dhangar.github.io.git |
| 90 | +``` |
| 91 | + |
| 92 | +This avoids fetching unnecessary data. |
| 93 | + |
| 94 | +--- |
| 95 | + |
| 96 | +### 4. Switch to SSH |
| 97 | + |
| 98 | +Sometimes HTTPS causes issues. If you have SSH keys set up: |
| 99 | + |
| 100 | +```bash |
| 101 | +git clone [email protected]:ajay-dhangar/ajay-dhangar.github.io.git |
| 102 | +``` |
| 103 | + |
| 104 | +This is often more reliable for big repos. |
| 105 | + |
| 106 | +--- |
| 107 | + |
| 108 | +### 5. Sparse Checkout (Download Only What You Need) |
| 109 | + |
| 110 | +If you don’t need the whole repo, just a folder: |
| 111 | + |
| 112 | +```bash |
| 113 | +git clone --filter=blob:none https://github.com/ajay-dhangar/ajay-dhangar.github.io.git |
| 114 | +cd ajay-dhangar.github.io |
| 115 | +git sparse-checkout init --cone |
| 116 | +git sparse-checkout set <folder-you-need> |
| 117 | +``` |
| 118 | + |
| 119 | +This keeps your local clone lightweight. |
| 120 | + |
| 121 | +--- |
| 122 | + |
| 123 | +### 6. Use Git LFS for Large Files |
| 124 | + |
| 125 | +If your repo has big media files, install [Git LFS](https://git-lfs.com/): |
| 126 | + |
| 127 | +```bash |
| 128 | +git lfs install |
| 129 | +git lfs clone https://github.com/ajay-dhangar/ajay-dhangar.github.io.git |
| 130 | +``` |
| 131 | + |
| 132 | +This prevents huge files from breaking your clone process. |
| 133 | + |
| 134 | +--- |
| 135 | + |
| 136 | +## Final Takeaway |
| 137 | + |
| 138 | +If you’re facing the `RPC failed; curl 92 HTTP/2` error: |
| 139 | + |
| 140 | +* Start with **`--depth=1`** (quickest fix). |
| 141 | +* If you need full history, increase the buffer size. |
| 142 | +* For big repos with assets, use **Git LFS or sparse checkout**. |
| 143 | + |
| 144 | +These tricks saved me hours of frustration, and I hope they help you too. |
0 commit comments