Git refs/remotes/origin/master does not point to a valid object

后端 未结 2 1371
礼貌的吻别
礼貌的吻别 2021-01-31 03:42

After the last merge to the master branch of my Git repository I have lost the ability to clone repository.

Cloning into test-repository...
remote: Counting objects:          


        
相关标签:
2条回答
  • 2021-01-31 04:14

    Typically you can do:

    git reflog master
    

    This will give you a list of the last know positions that master has pointed to.

    Once you know this you can create a temporary branch to an older version of master ie

    git branch temp master@{1}
    

    Then checkout temp and see if it is in proper order. If you don't see anything there then the commands that you did previously (delete the reflog, delete dangling commits, etc) have probably wiped out all ways to recovery.

    0 讨论(0)
  • 2021-01-31 04:17
    git gc
    git fsck --full
    git reflog expire --expire=0 --all
    git update-ref -d 0d998c99b6d01e8aabca72b1934802acf90b8fc9
    git gc --aggressive
    git remote update --prune
    

    and it worked!

    0 讨论(0)
提交回复
热议问题