Git - fix the 'error: cannot lock ref 'refs/remotes/origin/'

0 votes
added Apr 11, 2019 in Git by LC Marshal Captain (25,790 points)
edited Oct 6, 2022 by LC Marshal
git gc --prune=now

and delete 
\YOUR_PROJECT.git\refs\remotes\origin\[PROBLEMATIC BRANCH] 

2 Responses

0 votes
responded May 13, 2019 by LC Marshal Captain (25,790 points)

As a workaround, you can always;

// Create new branch
git checkout -b newbranch

//push it back to remote
git push --set-upstream origin trx-local


0 votes
responded Sep 19, 2022 by lcjr First Warrant Officer (11,930 points)
// Its happened due to mismatch of commit Ids, it can be master branch too
[problematic branch]

// To fix, please update the ref reference) with the following command:
$ git update-ref -d refs/remotes/origin/[problematic branch]

// and pull
$git pull - Malaysia's programming knowledge sharing platform, where everyone can share their finding as reference to others.