简体   繁体   中英

How to mirror a GitHub repo using Github actions?

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM