We have a git repo on bitbucket server that has some refs we need to delete.
I can view the remote refs by calling:
git ls-remote --refs | grep pull-requests
Giving:
634746a29a3a077254960538a3fbc421a174d68b refs/pull-requests/426/merge
fe80ad1e8d34fab4bb599595c9c584bdbca33125 refs/pull-requests/450/from
...
764a8d6d4d307c7a1b57bcde76ef9fde140f3562 refs/pull-requests/614/from
1fba4de34e609d3dc33c092d39af0d4ad13030e1 refs/pull-requests/614/merge
These pull requests don't actually exist in bitbucket (i.e. Don't show up as real pull requests). The numbers for the pull requests mark them as being really old too, years old. So we need to delete them. So when I try removing one of those dangling refs, for instance:
git push --delete origin refs/pull-requests/364/from
Bitbucket returns an error message stating:
remote: You are attempting to update refs that are reserved for
Bitbucket's pull request functionality. Bitbucket manages these refs
automatically, and they may not be updated by users. remote: Rejected
refs: remote: refs/pull-requests/364/from remote:
First question: Why is Bitbucket being so damned fussy on this issue? It's my git repo, I want those deleted.
Second question: Am I calling the correct command to remove the remote ref?
Hey @CPJ , sorry for reviving this 3yo topic, but: have you found a solution?
Cheers
Hey @Fabio Pires , @CPJ , have any of you found a solution to this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, I basically renamed the repo to something like "reponame-old", created a new repo with the same name, and did something along the lines of:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, what worked for us was that we selectively pushed the references - that is, skip pushing the problematic references while pushing everything else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.