I am trying to execute following git command -
git fetch --tags --progress https://github.com/<org>/<repo-name>.git +refs/pull/*:refs/remotes/origin/pr/*
and constantly getting errors:
error: cannot lock ref 'refs/remotes/origin/pr/1/head': 'refs/remotes/origin/pr' exists; cannot create 'refs/remotes/origin/pr/1/head'
From https://github.com/<org>/<repo-name>
! [new ref] refs/pull/1/head -> origin/pr/1/head (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/pr/10/head': 'refs/remotes/origin/pr' exists; cannot create 'refs/remotes/origin/pr/10/head'
! [new ref] refs/pull/10/head -> origin/pr/10/head (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/pr/100/head': 'refs/remotes/origin/pr' exists; cannot create 'refs/remotes/origin/pr/100/head'
! [new ref] refs/pull/100/head -> origin/pr/100/head (unable to update local ref)
Any hints regarding how to solve would be really appreciated.
It looks like there used to be a branch called pr, and the new branch is in a folder with that name, so it is clashing.
Try git remote prune origin, which should remove the local tracked copy of the old branch, then your command again.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With