GitHub
This page describes the process to mirror a Copia repo to a GitHub repo.
Last updated
This page describes the process to mirror a Copia repo to a GitHub repo.
Last updated
NOTE: GitHub does not natively support Pull-based Mirroring. As a result of this, users must manually set up GitHub Actions to trigger, which then execute code to mirror the repo to GitHub. This is a clunky process because it requires that the GitHub action file gets added to both the GitHub repo the very first time, as well as the Copia repo, since the contents of the GitHub repo will be overwritten.
Another challenge is that scheduled Cron jobs in GitHub actions do not tend to trigger on time, so it is not a very deterministic way of backing up files from Copia. In order to do this in a more deterministic manner, users would need to use an external scheduler to tell the GitHub API to start the workflow. See more info on this .
See for a walkthrough tutorial for mirroring a Copia repo to GitHub.
Navigate to the Copia repo you want to mirror. Then navigate to the default branch at the top level.
Within your chosen repo, create a folder called .github
Within the .github folder, create another folder called workflows
Within this folder, create a file called mirror-workflow.yml, or something comparable
Copy and paste the code seen below
Modify the source_repo
field with the URL of the Copia repo that you'd like to mirror
Modify the "on:" field to trigger this action on that you'd like. The example code is scheduled to run every 5 minutes. NOTE: GitHub only attempts to run the workflow on the schedule. It is likely that the action will actually be delayed due to constraints in the GitHub system. See more info on this .
Commit and push your code to the main branch of the Copia repo
Now it's time to move to GitHub. Once in GitHub, follow the directions to
In your repository, you must add the following secrets (NOTE: These could conceivably be organizational secrets instead, which would avoid you needing to add them to every repo that is created)
MIRROR_SOURCE_TOKEN_COPIA
: Token created on the Copia website at
MIRROR_SOURCE_USER_COPIA
: Copia username of the user who is associated with the token
MIRROR_TARGET_TOKEN_GITHUB
: for the user associated with the GitHub account
MIRROR_TARGET_USER_GITHUB
: GitHub username of the user who is associated with the PAT
By default, imported repositories in GitHub have Actions disabled. Go to the repository settings and select the "Allow all actions and reusable workflows"
The example code, shown below, has the ability to manually trigger the workflow. In your GitHub repository, if you click on "Actions" and then select "Mirror files action" and then select "Run workflow" you can trigger an immediate run of the workflow to ensure that the workflow was successful