6

-- EDIT -- I ended up copying all files to another folder an pushed from there. Without the commit history. :(

Thanks for responding tho.

-- /EDIT --

I'm new to git. For my html5 app I used aptana's html5 boilerplate which installs a git repository for you. Nice. Now, after working on my app for a few weeks, I want to push it to github. I created a new repository there.

Now when I try to push to github from shell or tortoisegit I run into errors after all files are uploaded:

$ git push -u origin master ... remote: error: unable to find b4587434...<snip>...c701 (probably a checksum) remote: fatal: objet of unexpected type error: unpack failed: index-pack abnormal exit ! [remote rejected] master -> master (unpacker error) error: failed to push some refs to 'https://github.com/<user>/<project>.git' 

I have been looking all around for a solution, but haven't been able to find something yet. Some actions I tried that didn't help:

  • I have renamed origin to something else.
  • I've created another repository on github.
  • "git status" confirms that I have nothing to commit.

Please help, It's really frustrating that git costs so much time to figure out for something that should be simple. :(

3
  • What does git fsck --full say? Commented Mar 27, 2013 at 20:58
  • Checking objects directories: 100% Checking objects: 100% Commented Mar 27, 2013 at 21:00
  • I had the same issue on a centos 7. My git version was 1.8, after updating git to 2.17 the error disapeared. Commented Jan 16, 2020 at 10:41

3 Answers 3

5

I was trying to mirror Twbs bootstrap, but got an error like this and my problem was that I cloned the repo with --depth=1. I re-cloned the repo without the --depth= argument and everything worked perfectly using these steps:

  1. git clone --bare https://github.com/twbs/bootstrap.git
  2. cd bootstrap.git
  3. git push --mirror [email protected]:yourusername/your-repo-name.git
  4. cd ../ && rm -rf bootstrap.git
  5. git clone [email protected]:yourusername/your-repo-name.git
  6. cd your-repo-name
  7. git remote add twbs https://github.com/twbs/bootstrap.git

Now you can push to your own version of the repo with git push origin master and if you'd like to pull changes from the original repo you can simple do git pull twbs master.

More info available @ https://help.github.com/articles/duplicating-a-repository/

Sign up to request clarification or add additional context in comments.

Comments

0

So one thing you could try is:

  1. Go-to github.com/THE_REPO_YOU_MADE
  2. Copy the SSH url that is at the top of your repo
  3. Remove any old origin remotes

    git remote git remote rm origin 
  4. Create a github remote named "origin"(or whatever name you want)

    git remote add origin [email protected]:USER_NAME/REPO_NAME.git 
  5. Push your files to the remote you just added

    git push remote origin master 

these step are assuming that you have done:

git init # creates a local repo git add . # adds all files in the current directory git commit -m "init commit" #commits your init 

I know these are very basic steps and may not answer your error your receiving but these steps

one other thing to try is check to see if you have a repo inside of a repo. this is something that my students run into sometimes. it will cause some errors when tying to push and also with permissions

1 Comment

Thanks for the response. I have tried that and got the same result unfortunately. :(
0

Note: at least with git 2.0.1 (June 25th, 2014), the error message could be more specific.

See commit 77583e7 by Jeff King (peff):

index-pack: distinguish missing objects from type errors

When we fetch a pack that does not contain an object we expected to receive, we get an error like:

$ git init --bare tmp.git && cd tmp.git $ git fetch ../parent.git [...] error: Could not read 964953ec7bcc0245cb1d0db4095455edd21a2f2e fatal: Failed to traverse parents of commit b8247b40caf6704fe52736cdece6d6aae87471aa error: ../parent.git did not send all necessary objects 

This comes from the check_everything_connected rev-list. If we try cloning the same repo (rather than a fetch), we end up using index-pack's --check-self-contained-and-connected option instead, which produces output like:

$ git clone --no-local --bare parent.git tmp.git [...] fatal: object of unexpected type fatal: index-pack failed 

Not only is the sha1 missing, but it's a misleading message.
There's no type problem, but rather a missing object problem; we don't notice the difference because we simply compare OBJ_BAD != OBJ_BLOB.
Let's provide a different message for this case:

$ git clone --no-local --bare parent.git tmp.git fatal: did not receive expected object 6b00a8c61ed379d5f925a72c1987c9c52129d364 fatal: index-pack failed 

While we're at it, let's also improve a true type mismatch error to look like

fatal: object 6b00a8c61ed379d5f925a72c1987c9c52129d364: expected type blob, got tree 

3 Comments

Hi, did you get the right solution?
I have the same problem
@user1938143 I have no direct solution, just a better diagnostic through a more precise error message.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.