Reputation: 8351
I was trying to pull git branch bugfix/validator-integration-bugfix
using following command
git fetch && git checkout bugfix/validator-integration-bugfix
but I am getting following error:
akshaykhale$ git fetch && git checkout bugfix/validator-integration-bugfix
error: cannot lock ref 'refs/remotes/origin/bugfix/connection-failure-bugfix': 'refs/remotes/origin/bugfix' exists; cannot create 'refs/remotes/origin/bugfix/connection-failure-bugfix'
From https://github.com/luxio/luxio-framework
! [new branch] bugfix/connection-failure-bugfix -> origin/bugfix/connection-failure-bugfix (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/bugfix/migration-datatype-bugfix': 'refs/remotes/origin/bugfix' exists; cannot create 'refs/remotes/origin/bugfix/migration-datatype-bugfix'
! [new branch] bugfix/migration-datatype-bugfix -> origin/bugfix/migration-datatype-bugfix (unable to update local ref)
error: cannot lock ref 'refs/remotes/origin/bugfix/validator-integration-bugfix': 'refs/remotes/origin/bugfix' exists; cannot create 'refs/remotes/origin/bugfix/validator-integration-bugfix'
! [new branch] bugfix/validator-integration-bugfix -> origin/bugfix/validator-integration-bugfix (unable to update local ref)
Possible reason could be (just a guess):
I am fetching bugfix/validator-integration-bugfix
branch which is created from other branches which were not cloned on my development system.
any way to fix the issue
Thanks in advance!!!
Upvotes: 2
Views: 656
Reputation: 8351
Following worked for me:
git fetch --prune
With git prune
it pulled all the branches, I could switch to the required branch and able to push in the commits without any issues.
Thank you @MarkAdelsberger
Upvotes: 0
Reputation: 1759
Someone on your team has created a branch named bugfix
and pushed it to origin/bugfix
. Git will not allow you to create a branch with a name of the format origin/bugfix/*
because of this.
I'm guessing the branch was named bugfix
by mistake, so the solution is to give this branch a more descriptive name.
To rename the bugfix
branch locally:
git branch -m bugfix bugfix/sensible-name
Then to rename it on your remote:
git push origin :bugfix bugfix/sensible-name
Then set the renamed local branch to track the renamed remote branch:
git push origin -u bugfix/sensible-name
Upvotes: 2