git报错:data stream error (incorrect data check)和 The remote end hung up unexpectedly

      When uploading the code to oschina today, there may be some operational flaws, resulting in unsuccessful git push. record it here

1. Error message

$ git push admin master
Counting objects: 2427, done.
Delta compression using up to 2 threads.
error: inflate: data stream error (incorrect data check)
fatal: loose object c39b1ec47665b00d7053c7f043b7b4a8402eb087 (stored in .git/objects/c3/9b1ec47665b00d7053c7f043b7b4a8402eb087) is corrupt
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
error: failed to push some refs to 'xxxx'
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

Second, the solution process

1. Search The remote end hung up unexpectedly
. Everyone said that the reason for the error is because the transfer file is too large, and the cache needs to be set to 500M. Well, I'll try it now.

git config http.postBuffer 524288000  
  • 1

      After trying it, I found that it still didn't work. I had already set a 500M cache here, that is to say, it should not be the reason why the transfer file was too large.

2. Search: loose object xxx (stored in .xxx) is corrupt
      This error is usually caused by an error in the previous git commit, such as an incorrect command (git commit -a "Some message", git commit "Some message", etc.) , resulting in an empty commit. The above error may occur when executing the git command again.

This bug fix is ​​cumbersome, the best solution is to delete the .git file and rebuild the local repository. Well, leave it alone and continue with Baidu.

3. Search: inflate: data stream error (incorrect data check)

Explanation: This error is a data flow error. It's also a hassle to fix. If you are interested, you can refer to:

3. Solutions

After some thought, I still feel that it is more convenient to re-initialize the code base. Because I have added a lot of new content in the past two days, if I can't find it again, I really want to cry without tears.

1. The first is to make a copy of the local project. don't lose it

2. Then delete the local code base.

3. Initialize the project

git init
  • 1

4. Establish a connection with oschina

git remote add origin your remote address
  • 1

5. Pull the project code from the remote warehouse

git pull
  • 1

6. In the newly created local warehouse, except the .git file, delete all other files. Then re-paste the project we just copied to the new local warehouse

7. The next step is to synchronize the remote warehouse. At this step, I am also holding the attitude of trying, but I did not expect it to be successful.

//General operation 
git add -A 
git commit -m 'xx'
git pull
git push
  • 1
  • 2
  • 3
  • 4
  • 5

8. Log in to the remote code base and view the project. It is found that we have successfully updated the remote repository. Now you don't have to worry that the new part will not be submitted.

4. Summary

      Overall it's still a shame. I still haven't found the reason for my mistake. However, after nearly two hours of Baidu, I think the problem lies in the data, it seems that some bytes are confused. . If anyone knows why, please remember to leave a comment. Thanks a lot.

Well, it's 1 am now, it's time to go to bed, good night.


Related: git报错:data stream error (incorrect data check)和 The remote end hung up unexpectedly