# Partial clone - bad pack header?

3 messages from 2019-02-04 to 2019-02-05. Participants: Luke Diamand, Jeff King.
Thread: https://gitlist.dev/t/50393

## Luke Diamand, 2019-02-04 13:45

Subject: Partial clone - bad pack header?
Message-ID: <CAE5ih7-Gi6i8ZRDjsVELLesTORRDxvrLYf00DYTBRFUWUmAAdw@mail.gmail.com>
URL: https://gitlist.dev/e/CAE5ih7-Gi6i8ZRDjsVELLesTORRDxvrLYf00DYTBRFUWUmAAdw%40mail.gmail.com

```
I tried to do a partial clone, but it gave me a "bad pack header". Is
there anything I can do to debug this?

I did "git config uploadpack.allowfilter true" in my repo.
Then I went to a scratch directory and did:
$ git clone --filter=blob:limit=10M ssh://localhost/~/git/my_big_repo
remote: Enumerating objects: 1619425, done.
remote: Counting objects: 100% (1619425/1619425), done.
remote: Compressing objects: 100% (362435/362435), done.
remote: Total 1619425 (delta 1225623), reused 1604277 (delta 1211975)
Receiving objects: 100% (1619425/1619425), 10.34 GiB | 35.61 MiB/s, done.
Resolving deltas: 100% (1225623/1225623), done.
Note: checking out 'a943f529b4781f34602f1ad5aab99a8699975c29'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

fatal: the remote end hung up unexpectedly
fatal: protocol error: bad pack header
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

$  git checkout origin/master
fatal: the remote end hung up unexpectedly
fatal: protocol error: bad pack header

$ git --version
git version 2.20.1.611.gfbb209baf1

There's plenty of disk space left.

Thanks,
Luke

```

## Jeff King, 2019-02-04 23:28

Subject: Re: Partial clone - bad pack header?
Message-ID: <20190204232844.GA2366@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20190204232844.GA2366%40sigill.intra.peff.net
In-Reply-To: <CAE5ih7-Gi6i8ZRDjsVELLesTORRDxvrLYf00DYTBRFUWUmAAdw@mail.gmail.com>

```
On Mon, Feb 04, 2019 at 01:45:35PM +0000, Luke Diamand wrote:

> I tried to do a partial clone, but it gave me a "bad pack header". Is
> there anything I can do to debug this?
> 
> I did "git config uploadpack.allowfilter true" in my repo.
> Then I went to a scratch directory and did:
> $ git clone --filter=blob:limit=10M ssh://localhost/~/git/my_big_repo
> remote: Enumerating objects: 1619425, done.
> remote: Counting objects: 100% (1619425/1619425), done.
> remote: Compressing objects: 100% (362435/362435), done.
> remote: Total 1619425 (delta 1225623), reused 1604277 (delta 1211975)
> Receiving objects: 100% (1619425/1619425), 10.34 GiB | 35.61 MiB/s, done.
> Resolving deltas: 100% (1225623/1225623), done.
> Note: checking out 'a943f529b4781f34602f1ad5aab99a8699975c29'.
> [...]
> fatal: the remote end hung up unexpectedly
> fatal: protocol error: bad pack header
> warning: Clone succeeded, but checkout failed.

Just a guess, but does setting uploadpack.allowAnySHA1InWant to "true"
in the source repo help?

By default, upload-pack will not allow the client to request those
arbitrary blob sha1s. I thought it was _supposed_ to notice this and
complain with a nice error message, but I know I have run into cases in
the past where it does not (but never tracked it down -- this may well
be one of them).

-Peff

```

## Luke Diamand, 2019-02-05 10:14

Subject: Re: Partial clone - bad pack header?
Message-ID: <CAE5ih7-8Z6r1yrRMZN24wEoOqz_S=63HGg9RkNyYXhbXFgh1Fg@mail.gmail.com>
URL: https://gitlist.dev/e/CAE5ih7-8Z6r1yrRMZN24wEoOqz_S%3D63HGg9RkNyYXhbXFgh1Fg%40mail.gmail.com
In-Reply-To: <20190204232844.GA2366@sigill.intra.peff.net>

```
On Mon, 4 Feb 2019 at 23:28, Jeff King <peff@peff.net> wrote:
>
> On Mon, Feb 04, 2019 at 01:45:35PM +0000, Luke Diamand wrote:
>
> > I tried to do a partial clone, but it gave me a "bad pack header". Is
> > there anything I can do to debug this?
> >
> > I did "git config uploadpack.allowfilter true" in my repo.
> > Then I went to a scratch directory and did:
> > $ git clone --filter=blob:limit=10M ssh://localhost/~/git/my_big_repo
> > remote: Enumerating objects: 1619425, done.
> > remote: Counting objects: 100% (1619425/1619425), done.
> > remote: Compressing objects: 100% (362435/362435), done.
> > remote: Total 1619425 (delta 1225623), reused 1604277 (delta 1211975)
> > Receiving objects: 100% (1619425/1619425), 10.34 GiB | 35.61 MiB/s, done.
> > Resolving deltas: 100% (1225623/1225623), done.
> > Note: checking out 'a943f529b4781f34602f1ad5aab99a8699975c29'.
> > [...]
> > fatal: the remote end hung up unexpectedly
> > fatal: protocol error: bad pack header
> > warning: Clone succeeded, but checkout failed.
>
> Just a guess, but does setting uploadpack.allowAnySHA1InWant to "true"
> in the source repo help?

That's a very good guess - it works a treat with that!

>
> By default, upload-pack will not allow the client to request those
> arbitrary blob sha1s. I thought it was _supposed_ to notice this and
> complain with a nice error message, but I know I have run into cases in
> the past where it does not (but never tracked it down -- this may well
> be one of them).
>
> -Peff

```
