Uploaded image for project: 'Bitbucket Cloud'
  1. Bitbucket Cloud
  2. BCLOUD-9097

Cannot delete remote branch; "remote: permission denied to delete branch (name)"

      I have deleted a branch locally using :

      git branch -d (branch_name)

      I then attempted to delete the remote branch using :

      git push origin :(branch_name)

      however that command gives me the following error :

      _remote: permission denied to delete branch (branch_name)
      To https://(my_account)@bitbucket.org/specialsource-ondemand/(repo).git\\
      ! [remote rejected] (branch_name) (pre-receive hook declined)
      error: failed to push some refs to 'https://(my_account)@bitbucket.org/specialsource-ondemand/(repo).git'_


      Why am I unable to delete the branch at origin?
      Am I doing something wrong?

          Form Name

            [BCLOUD-9097] Cannot delete remote branch; "remote: permission denied to delete branch (name)"

            I think you are right. let me raise the new issue.

            Thanks for your responses.

            Amit Andharia added a comment - I think you are right. let me raise the new issue. Thanks for your responses.

            Hi Amit - I'm not all that familiar with bitbucket I'm afraid - except as a repo and a tool for looking at commits and such - I haven't actually used the issue tracker or wiki before.

            Maybe Dan or Brodie can help?

            Otherwise, I think this is a different issue and maybe deserves it's own post "How do I delete the repo but keep the issue tracker and wiki?"

            Kris Randall added a comment - Hi Amit - I'm not all that familiar with bitbucket I'm afraid - except as a repo and a tool for looking at commits and such - I haven't actually used the issue tracker or wiki before. Maybe Dan or Brodie can help? Otherwise, I think this is a different issue and maybe deserves it's own post "How do I delete the repo but keep the issue tracker and wiki?"

            @krisrandall - yes i understand what do you mean, but the thing is i want to clean just the source code, not the issue tracker & wiki. Is there any work around?

            Amit Andharia added a comment - @krisrandall - yes i understand what do you mean, but the thing is i want to clean just the source code, not the issue tracker & wiki. Is there any work around?

            As the OP, I write to confirm that the original response from Dan was essentially correct for my issue - the admin of the repo told me that he had set the repo so that deletes were not allowed, and that has since been changed.
            Thanks for the response, and for your further comments Rajib.

            Amit -
            If you are trying to delete the "master" branch, I am guessing that is not allowed, there is not really any repo without a master branch as far as I understand - you probably want to do an action which deletes the repo instead.
            I don't know if that helps - I hope you get it sorted.

            Kris Randall added a comment - As the OP, I write to confirm that the original response from Dan was essentially correct for my issue - the admin of the repo told me that he had set the repo so that deletes were not allowed, and that has since been changed. Thanks for the response, and for your further comments Rajib. Amit - If you are trying to delete the "master" branch, I am guessing that is not allowed, there is not really any repo without a master branch as far as I understand - you probably want to do an action which deletes the repo instead. I don't know if that helps - I hope you get it sorted.

            rajibmp added a comment -

            Unfortunately once the issue is marked SOLVED, no one dares to turn back to it, its just a normal development process where you have to close the tickets instead of open the dead grave. So, you might try to open the new issue above, if you still have problem.

            For me, In Settings->Branch Management I had prevent deletion of these branch to * (that means all). So, I had to remove that one from there, delete the branch and put that * back again.

            I wish if Bitbucket devs could have taken more time to explain more precisely why they have closed the issue without proper explanation. Instead of just closing the issue due to inactivity without even responding to ask more info from the OP.

            I agree first comment is Spot-On and gives you clear hint where the problem is, BUT BUT BUT everyone is not that smart enough to understand likewise looking for clear simple instructions.

            Anyways, I got my issue solved, cheers

            rajibmp added a comment - Unfortunately once the issue is marked SOLVED, no one dares to turn back to it, its just a normal development process where you have to close the tickets instead of open the dead grave. So, you might try to open the new issue above, if you still have problem. For me, In Settings->Branch Management I had prevent deletion of these branch to * (that means all). So, I had to remove that one from there, delete the branch and put that * back again. I wish if Bitbucket devs could have taken more time to explain more precisely why they have closed the issue without proper explanation. Instead of just closing the issue due to inactivity without even responding to ask more info from the OP. I agree first comment is Spot-On and gives you clear hint where the problem is, BUT BUT BUT everyone is not that smart enough to understand likewise looking for clear simple instructions. Anyways, I got my issue solved, cheers

            any updates on this? I'm also getting the same error.... I'm the admin, i've just one branch master, i want to delete it. no branch level restriction applied in settings > branches.

            Amit Andharia added a comment - any updates on this? I'm also getting the same error.... I'm the admin, i've just one branch master, i want to delete it. no branch level restriction applied in settings > branches.

            rajibmp added a comment -

            I am the owner/admin of the repo and getting same error.

            rajibmp added a comment - I am the owner/admin of the repo and getting same error.

            aiiie added a comment -

            We're closing this issue due to inactivity. If there's still a problem, please let us know. Thanks!

            aiiie added a comment - We're closing this issue due to inactivity. If there's still a problem, please let us know. Thanks!

            @Dan added a comment -

            No, the branch cannot be deleted not because you are doing something wrong, but because the repository administrator has set branch-level restrictions on the repo. Can you check to make sure the branch isn't restricted by an admin?

            @Dan added a comment - No, the branch cannot be deleted not because you are doing something wrong, but because the repository administrator has set branch-level restrictions on the repo. Can you check to make sure the branch isn't restricted by an admin?

              93e1e5ba154a aiiie
              fe7ee3825bc8 Kris Randall
              Affected customers:
              0 This affects my team
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: