murtaza52
murtaza52

Reputation: 47431

push to remote repo gives the error - there are still refs under

I am trying to push code to a remote repo -

git push uat release/1.1:release
Counting objects: 4047, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (1679/1679), done.
Writing objects: 100% (4047/4047), 3.38 MiB | 1.79 MiB/s, done.
Total 4047 (delta 2160), reused 3666 (delta 1909)
remote: Switched to branch 'release'
To ubuntu@ubuntu-jvm:/repos/tms/uat
 * [new branch]      release/1.1 -> release
error: there are still refs under 'refs/remotes/uat/release'
error: Cannot lock the ref 'refs/remotes/uat/release'.

How do I resolve the above error.

Upvotes: 7

Views: 14868

Answers (1)

twalberg
twalberg

Reputation: 62389

I suspect you have other branches named release/<something> on your uat remote. The push command you are running is trying to convert a local branch release/1.1 into a remote branch release, but the remote refuses to remove release/<something> because that would lose information. Try git push uat release/1.1:newrelease or something similar to avoid the conflict of trying to have a single branch named the same thing as a "subdirectory" containing other branches (it's not truly a subdirectory, but the way git works internally, it is sometimes stored as an actual subdirectory).

git remote show uat or git branch -r will show you what branches your uat remote has.

Upvotes: 7

Related Questions