Skip to content

Instantly share code, notes, and snippets.

@hbons
Created January 14, 2015 16:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hbons/c97ee57c6738ab2c511e to your computer and use it in GitHub Desktop.
Save hbons/c97ee57c6738ab2c511e to your computer and use it in GitHub Desktop.
git fetch --update-shallow
@gerhard-tinned
Copy link

Executed the following command to create and commit a change (SparkleShare not running to understand inner workings).

    $ date >>date
    $ git add date
    $ git commit -m "test"

Then i tried to push it ...

    $ git push origin master
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 609 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    fatal: protocol error: expected old/new/ref, got 'shallow fa4b0534ad4acbd8d2fa387019aeff6b0b41ae7f'
    fatal: The remote end hung up unexpectedly
    fatal: The remote end hung up unexpectedly

So i tried it again with fetch first ...

    $ git fetch --update-shallow
    $ git push origin master
    Counting objects: 3, done.
    Writing objects: 100% (3/3), 609 bytes | 0 bytes/s, done.
    Total 3 (delta 0), reused 0 (delta 0)
    fatal: protocol error: expected old/new/ref, got 'shallow fa4b0534ad4acbd8d2fa387019aeff6b0b41ae7f'
    fatal: The remote end hung up unexpectedly
    fatal: The remote end hung up unexpectedly

Still no luck.

@gerhard-tinned
Copy link

The git man page of git-clone does not state it but Linux git-clone man pages state this.

--depth
Create a shallow clone with a history truncated to the specified
number of revisions. A shallow repository has a number of
limitations (you cannot clone or fetch from it, nor push from nor
into it
), but is adequate if you are only interested in the recent
history of a large project with a long history, and would want to
send in fixes as patches.

@gerhard-tinned
Copy link

Sparkleshare git version 1.8.1.3
Mac OS X git version 2.2.1

Server git version 1.7.1
... there is no newer version in the centos repositories.

@gerhard-tinned
Copy link

It seems that git 2.2.1 does not allow pushing a shallow repository to a git 1.7.1 server.

It seems to work with the 1.8.1.3 client to push to the 1.7.1 server. :)

@gerhard-tinned
Copy link

Manually downgraded/switched to 1.8 version of git via homebrew.

$ brew switch git 1.8.5.2

That solved the issue. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment