I'm following this documentation: https://help.github.com/articles/duplicating-a-repository/
git clone --mirror https://github.com/exampleuser/repository-to-mirror.git cd repository-to-mirror.git git push --mirror https://github.com/exampleuser/mirrored
The output shows that the repository is pushed as a mirror, but for some reason I'm getting these errors as well:
! [remote rejected] refs/pull/1/head -> refs/pull/1/head (deny updating a hidden ref) ! [remote rejected] refs/pull/1/merge -> refs/pull/1/merge (deny updating a hidden ref)
What are these errors? Can I assume the repository was mirrored ?
Git mirroring is when a mirror copies the refs & the remote-tracking branches. It's supposed to be a functionally identical copy that is interchangeable with the original.
You first have to get the original Git repository on your machine. Then, go into the repository. Finally, use the --mirror flag to copy everything in your local Git repository into the new repo.
A clone copies the refs from the remote and stuffs them into a subdirectory named 'these are the refs that the remote has'. A mirror copies the refs from the remote and puts them into its own top level - it replaces its own refs with those of the remote.
repository-mirroring-actionA GitHub Action for mirroring a repository to another repository on GitHub, GitLab, BitBucket, AWS CodeCommit, etc. This will copy all commits, branches and tags. ⚠️ Note that the other settings will not be copied.
As mentioned in this issue, that happens when you mirror a GitHub repo which has pull requests made to it.
The refs beginning '
refs/pull
' are synthetic read-only refs created by GitHub - you can't update (and therefore 'clean') them, because they reflect branches that may well actually come from other repositories - ones that submitted pull-requests to you.So, while you've pushed all your real refs, the pull requests don't get updated
You would need to mirror a GitHub repo without their pull requests.
Simply replace the catch-all refspec above with two more specific specs to just include all heads and tags, but not the pulls, and all the remote pull refs will no longer make it into your bare mirror:
fetch = +refs/heads/*:refs/heads/* fetch = +refs/tags/*:refs/tags/* fetch = +refs/change/*:refs/change/*
If push still fails, as commented by Ofek Shilon, add the push entries:
push = +refs/heads/*:refs/heads/* push = +refs/tags/*:refs/tags/* push = +refs/change/*:refs/change/*
As mention in Git Refspec:
The
+
tells Git to update the reference even if it isn’t a fast-forward.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With