4.3 KiB
date | title | slug | weight | toc | draft | menu | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2021-05-13T00:00:00-00:00 | Repository Mirror | repo-mirror | 45 | false | false |
|
Repository Mirror
Repository mirroring allows for the mirroring of repositories to and from external sources. You can use it to mirror branches, tags, and commits between repositories.
Table of Contents
{{< toc >}}
Use cases
The following are some possible use cases for repository mirroring:
- You migrated to Gitea but still need to keep your project in another source. In that case, you can simply set it up to mirror to Gitea (pull) and all the essential history of commits, tags, and branches are available in your Gitea instance.
- You have old projects in another source that you don’t use actively anymore, but don’t want to remove for archiving purposes. In that case, you can create a push mirror so that your active Gitea repository can push its changes to the old location.
Pulling from a remote repository
For an existing remote repository, you can set up pull mirroring as follows:
- Select New Migration in the Create... menu on the top right.
- Select the remote repository service.
- Enter a repository URL.
- If the repository needs authentication fill in your authentication information.
- Check the box This repository will be a mirror.
- Select Migrate repository to save the configuration.
The repository now gets mirrored periodically from the remote repository. You can force a sync by selecting Synchronize Now in the repository settings.
Pushing to a remote repository
For an existing repository, you can set up push mirroring as follows:
- In your repository, go to Settings > Repository, and then the Mirror Settings section.
- Enter a repository URL.
- If the repository needs authentication expand the Authorization section and fill in your authentication information.
- Select Add Push Mirror to save the configuration.
The repository now gets mirrored periodically to the remote repository. You can force a sync by selecting Synchronize Now. In case of an error a message displayed to help you resolve it.
❗❗ NOTE: This will force push to the remote repository. This will overwrite any changes in the remote repository! ❗❗
Setting up a push mirror from Gitea to GitHub
To set up a mirror from Gitea to GitHub, you need to follow these steps:
- Create a GitHub personal access token with the public_repo box checked.
- Fill in the Git Remote Repository URL:
https://github.com/<your_github_group>/<your_github_project>.git
. - Fill in the Authorization fields with your GitHub username and the personal access token.
- Select Add Push Mirror to save the configuration.
The repository pushes shortly thereafter. To force a push, select the Synchronize Now button.
Setting up a push mirror from Gitea to GitLab
To set up a mirror from Gitea to GitLab, you need to follow these steps:
- Create a GitLab personal access token with write_repository scope.
- Fill in the Git Remote Repository URL:
https://<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git
. - Fill in the Authorization fields with
oauth2
as Username and your GitLab personal access token as Password. - Select Add Push Mirror to save the configuration.
The repository pushes shortly thereafter. To force a push, select the Synchronize Now button.
Setting up a push mirror from Gitea to Bitbucket
To set up a mirror from Gitea to Bitbucket, you need to follow these steps:
- Create a Bitbucket app password with the Repository Write box checked.
- Fill in the Git Remote Repository URL:
https://bitbucket.org/<your_bitbucket_group_or_name>/<your_bitbucket_project>.git
. - Fill in the Authorization fields with your Bitbucket username and the app password as Password.
- Select Add Push Mirror to save the configuration.
The repository pushes shortly thereafter. To force a push, select the Synchronize Now button.