I would like to know if there is a way to use GitHub Actions to automatically mirror changes from repoA
to repoB
.
Both would be private repositories.
The workflow would be like this: a commit would be pushed to a branch on repoA
and then automatically the same commit would be sent to repoB
as well.
I've seen posts on adding a remote repository, but would be interested to see how GitHub Actions can help to improve this.
Navigate to the repository you just cloned. Pull in the repository's Git Large File Storage objects. Mirror-push to the new repository. Push the repository's Git Large File Storage objects to your mirror.
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.
No. Don't do that! Have your users add both repos as separate remotes to their local repos and give them a little shell-script or macro that converts git push into pushes to all currently available repos.
However, what we want with mirroring is to replicate the state of an origin repository (or upstream repository). By state, we mean all the branches (including master ) and all the tags as well. You'll need to do this when migrating your upstream repository to a new “home”, like when switching services like GitHub.
You might consider a GitHub Action like Git Sync:
A GitHub Action for syncing between two independent repositories using force push.
You add use in it an SSH private key to access to your second repository
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
(since you can create and store encrypted secrets in a workflow)
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