2

I am unable to pull changes from the remote repository due to the following error. I am trying to pull from the master branch of this repository.

c:\supportal>git pull
error: cannot lock ref 'refs/remotes/origin/KANBAN': unable to resolve 
reference refs/remotes/origin/KANBAN: Invalid argument
From https://github.cerner.com/ApplicationServices/supportal
! [new branch]      KANBAN     -> origin/KANBAN  (unable to update local 
ref)
error: cannot lock ref 'refs/remotes/origin/kanban': unable to resolve 
reference refs/remotes/origin/kanban: Invalid argument
! [new branch]      kanban     -> origin/kanban  (unable to update local 
ref)

The remote repository KANBAN was an old working directory that I am not using anymore. Not sure how to fix this.

I tried the following, which did not work: git remote prune origin

$ git gc --prune=now
error: bad ref for refs/remotes/origin/kanban
fatal: bad object refs/remotes/origin/kanban
error: failed to run repack

I also removed the remote origin reference and re-added it, then ran a git pull but that did not fix it as well..

Rookie
  • 5,179
  • 13
  • 41
  • 65
  • Does this answer your question? [How to handle git gc fatal: bad object refs/remotes/origin/HEAD error?](https://stackoverflow.com/questions/37145151/how-to-handle-git-gc-fatal-bad-object-refs-remotes-origin-head-error) – Gino Mempin Apr 05 '21 at 09:46

4 Answers4

2

Not sure what happened here.. But I was able to fix this myself by deleting ta file called kanban in repo_location/.git/refs/remote and then running a 'git pull' command.

Rookie
  • 5,179
  • 13
  • 41
  • 65
0

I'm assuming you want to remove the original origin remote and update it to the new one.

Have you tried the following:

git remote set-url origin <new location>
Player1st
  • 1,575
  • 10
  • 14
  • This did not work... getting the same error. All I am trying to do is pull the changes from remote master branch to my local. But I am getting the above error. – Rookie Feb 17 '18 at 00:55
0

git remote set-url origin this worked for me.

0

I face the same problem. I couldn't pull changes from the remote and get fatal: bad object refs/remotes/origin/Master

I solve the issue by creating a new project then clone the repository. I know this is not a solution but it works.

NOTE: If you made local changes that are not in the cloud; Obviously, local changes will be lost, but you can copy and paste