I want to mirror clone a Bitbucket Repository to another Bitbucket Repository.
I manage this with a shell script, which does the following:
git clone --mirror <sourceUrl>
git remote set-url --push origin <targetUrl>
git push --mirror
remote: You are attempting to update refs that are reserved for Bitbucket's pull
remote: request functionality. Bitbucket manages these refs automatically, and they may
remote: not be updated by users.
remote: Rejected refs:
! [remote rejected] refs/pull-requests/21/from -> refs/pull-requests/21/from (pre-receive hook declined)
! [remote rejected] refs/pull-requests/23/from -> refs/pull-requests/23/from (pre-receive hook declined)
! [remote rejected] refs/pull-requests/23/merge -> refs/pull-requests/23/merge (pre-receive hook declined)
! [remote rejected] refs/pull-requests/24/from -> refs/pull-requests/24/from (pre-receive hook declined)
! [remote rejected] refs/pull-requests/24/merge -> refs/pull-requests/24/merge (pre-receive hook declined)
error: failed to push some refs to '...'
repositoryformatversion = 0
filemode = true
bare = true
fetch = +refs/heads/*:refs/heads/*
fetch = +refs/tags/*:refs/tags/*
url = <sourceUrl>
mirror = true
pushurl = <targetUrl>
fetch = +refs/*:refs/*
Thanks to Ivan.
His command solved my Problem. I only had to add the "-r" parameter to xargs to react on empty greps:
git show-ref | cut -d' ' -f2 | grep 'pull-request' | xargs -r -L1 git update-ref -d