Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git [remote rejected] - cannot lock ref

Tags:

git

github

I'm trying to push a local branch to GitHub project I forked (ASP.Net/Docs) and I'm receiving the following error:

mdepouw@my-awesome-pc MINGW64 ~/source/repos/GitHub/spottedmahn/aspnet/Docs (dev/test1)

$ git push --set-upstream origin dev/test1

Counting objects: 6, done.

Delta compression using up to 8 threads.

Compressing objects: 100% (6/6), done.

Writing objects: 100% (6/6), 501 bytes | 501.00 KiB/s, done.

Total 6 (delta 5), reused 0 (delta 0)

remote: Resolving deltas: 100% (5/5), completed with 5 local objects.

To https://github.com/spottedmahn/Docs.git ! [remote rejected] dev/test1 -> dev/test1 (cannot lock ref 'refs/heads/dev/test1': 'refs/heads/dev' exists; cannot create 'refs/heads/dev/test1')

error: failed to push some refs to 'https://github.com/spottedmahn/Docs.git'

like image 761
spottedmahn Avatar asked Jun 24 '26 05:06

spottedmahn


1 Answers

It turns out there was a branch named dev in the repo I forked and I was trying to use dev/test1.

I renamed my branch to dev2/test1 and the push succeeded.


When I inspected the branches in VS I noticed it. I was also not allowed to check it out.

check out conflict

like image 155
spottedmahn Avatar answered Jun 25 '26 20:06

spottedmahn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!