I have a git repository which was constructed something like this.
$ git init
After many adds, commits, and furious keyboard-pounding, I am ready to push it to my GitHub repo.
$ git remote add origin git@github.com:me/Foo.git
$ git push -u origin master
Counting objects: 456, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (125/125), done.
remote: error: object c9edb23c0e6c48772785b2a7d89d08c0807b2d4a:contains duplicate file entries
remote: fatal: Error in object
error: pack-objects died of signal 13
error: failed to push some refs to 'git@github.com:me/Foo.git'
Searching SO, I found the article git tree contains duplicate file entries and followed the instructions there.
$ git ls-tree c9edb > bad_tree.txt
remove duplicate entry (there was only 1!)
$ cat bad_tree.txt | git mktree
8ec5fe5a729ff6f71209cb9a4f75b0059c049190
$ git replace c9edb 8ec5f
$ git fsck --full
Checking object directories: 100% (256/256), done.
error in tree c9edb23c0e6c48772785b2a7d89d08c0807b2d4a: contains duplicate file entries
Checking objects: 100% (457/457), done.
Ok, the article said that fsck will still show the bad tree, but push should now work. Let's fix the signal 13. The SO article Can't push to GitHub error: pack-objects died of signal 13 said it's a file size thing. Ok, let's check this out.
$ git count-objects -v
count: 0
size: 0
in-pack: 457
packs: 1
size-pack: 1910
prune-packable: 0
garbage: 0
size-garbage: 0
Hmm, that's weird. It says it's only 1.9MB. Let's double-check.
$ du -h .git
8.0K .git/logs/refs/heads
12K .git/logs/refs
24K .git/logs
1.9M .git/objects/pack
8.0K .git/objects/info
1.9M .git/objects
44K .git/hooks
4.0K .git/branches
12K .git/info
4.0K .git/refs/heads
4.0K .git/refs/tags
4.0K .git/refs/replace
16K .git/refs
2.1M .git
Ok, something is crazy. Git and the filesystem agree that the whole repository is only ~2MB, but I'm getting signal-13 on push. Hmm. Let's try it again.
$ git push -u origin master
Counting objects: 456, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (125/125), done.
remote: error: object c9edb23c0e6c48772785b2a7d89d08c0807b2d4a:contains duplicate file entries
remote: fatal: Error in object
fatal: The remote end hung up unexpectedly
error: pack-objects died of signal 13
error: failed to push some refs to 'git@github.com:me/Foo.git'
Grr. The "content manager from hell", indeed. Is my repo just knackered? Is there any possibility of pushing only the last commit to github without the history? (and prefereably without making my local repo a remote of another local repo and copy-pastaing the whole thing over).