Home > database >  Can't git push due to "remote: fatal: bad object refs/pull-requests/{pull_request_id}"
Can't git push due to "remote: fatal: bad object refs/pull-requests/{pull_request_id}"

Time:11-24

I clone a private repo then create a test branch from master and push it unsuccessfully.

Here is the command output:

$ git push --set-upstream origin test
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
remote: fatal: bad object refs/pull-requests/101/v2
fatal: bad object refs/pull-requests/101/v2
To ssh://git.my_repo_host:9999/my_repo.git
 ! [remote rejected]   test -> test (missing necessary objects)
error: failed to push some refs to 'ssh://git.my_repo_host:9999/my_repo.git'

I also tried git fsck --full and git gc but no luck:

$ git fsck --full
Checking object directories: 100% (256/256), done.
Checking objects: 100% (31288/31288), done.
Verifying commits in commit graph: 100% (4081/4081), done.

$ git gc
Enumerating objects: 31288, done.
Counting objects: 100% (31288/31288), done.
Delta compression using up to 8 threads
Compressing objects: 100% (13738/13738), done.
Writing objects: 100% (31288/31288), done.
Total 31288 (delta 15511), reused 31274 (delta 15505), pack-reused 0 

And this is the output of git config --local -l on master branch, nothing special here.

$ git config --local -l
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true
remote.origin.url=ssh://[email protected]_repo_host:9999/my_repo.git
remote.origin.fetch= refs/heads/*:refs/remotes/origin/*
branch.master.remote=origin
branch.master.merge=refs/heads/master

Final Update

The git data on my remote repo host has been corrupted after the IT team did maintenance recently. It backs to normal after their fix.
Sorry, No more detail (how did they fixed) from them.

CodePudding user response:

The error message is coming from the Git software on git.my_repo_host, indicating that there is a problem in the repository at ssh://git.my_repo_host:9999/my_repo.git. We can tell because of this line:

remote: fatal: bad object refs/pull-requests/101/v2

The word remote here means your Git software is relaying a message generated by the other host's software.

So, it is the remote repository that needs to be repaired or replaced. Your own local repository is OK.

Find the administrators of git.my_repo_host and have them fix the other machine's repository.

  •  Tags:  
  • git
  • Related