Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the git remote branch from bitbucket?

Tags:

git

bitbucket

I try to remove the git remote branch on the bitbucket by git push command:

qty:workspace qrtt1$ git push origin :my_branch
remote: fatal: bad object 0000000000000000000000000000000000000000
remote: bb/acl: qrtt1 is allowed. accepted payload.
remote: fatal: bad object 0000000000000000000000000000000000000000
To [email protected]:qrtt1/workspace.git
 - [deleted]         my_branch

However, only the branch in my local stroage removed. How do I remove it ?

PS. I can remove the remote branch in the same way from github.

like image 821
qrtt1 Avatar asked Nov 08 '11 03:11

qrtt1


People also ask

How do I delete a remote main branch?

Deleting remote branches To delete a remote branch, you can't use the git branch command. Instead, use the git push command with --delete flag, followed by the name of the branch you want to delete. You also need to specify the remote name ( origin in this case) after git push .


3 Answers

You can't delete a branch from Bitbucket if that branch is set as the Main Branch. You need to go into the Admin section of your Bitbucket repository and select a different branch for the Main Branch. You should then be able to remote the branch using

git push <repository> :<branch>
like image 78
smbruce Avatar answered Oct 13 '22 11:10

smbruce


Eventhough, it says those errors / warnings (probably some post hook that BitBucket has that is not proper?), it has gone ahead and deleted the my_branch branch, as indicated by the last line. Go to the web UI and confirm that the branch is indeed gone.

like image 32
manojlds Avatar answered Oct 13 '22 12:10

manojlds


I found the same problem, only the local is removed but not remote. Finally I found the solution from http://groups.google.com/group/gitorious/browse_thread/thread/5afe8581cdd96d2b, just use

git push <repository> :<branch>

After that checked on bitbucket website, it should be gone.

like image 26
haxpor Avatar answered Oct 13 '22 10:10

haxpor