1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00
gitea/docs/content/doc/usage/repo-mirror.en-us.md
John Olheiser bb25f85ce8
Refactor docs (#23752)
This was intended to be a small followup for
https://github.com/go-gitea/gitea/pull/23712, but...here we are.

1. Our docs currently use `slug` as the entire URL, which makes
refactoring tricky (see https://github.com/go-gitea/gitea/pull/23712).
Instead, this PR attempts to make future refactoring easier by using
slugs as an extension of the section. (Hugo terminology)
- What the above boils down to is this PR attempts to use directory
organization as URL management. e.g. `usage/comparison.en-us.md` ->
`en-us/usage/comparison/`, `usage/packages/overview.en-us.md` ->
`en-us/usage/packages/overview/`
- Technically we could even remove `slug`, as Hugo defaults to using
filename, however at least with this PR it means `slug` only needs to be
the name for the **current file** rather than an entire URL
2. This PR adds appropriate aliases (redirects) for pages, so anything
on the internet that links to our docs should hopefully not break.
3. A minor nit I've had for a while, renaming `seek-help` to `support`.
It's a minor thing, but `seek-help` has a strange connotation to it.
4. The commits are split such that you can review the first which is the
"actual" change, and the second is added redirects so that the first
doesn't break links elsewhere.

---------

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-04-28 11:33:41 +08:00

5.1 KiB
Raw Blame History

date title slug weight toc draft aliases menu
2021-05-13T00:00:00-00:00 Repository Mirror repo-mirror 45 false false
/en-us/repo-mirror
sidebar
parent name weight identifier
usage Repository Mirror 45 repo-mirror

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 dont use actively anymore, but dont 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:

  1. Select New Migration in the Create... menu on the top right.
  2. Select the remote repository service.
  3. Enter a repository URL.
  4. If the repository needs authentication fill in your authentication information.
  5. Check the box This repository will be a mirror.
  6. 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.

NOTE: You can only set up pull mirroring for repos that don't exist yet on your instance. Once the repo is created, you can't convert it into a pull mirror anymore.

Pushing to a remote repository

For an existing repository, you can set up push mirroring as follows:

  1. In your repository, go to Settings > Repository, and then the Mirror Settings section.
  2. Enter a repository URL.
  3. If the repository needs authentication expand the Authorization section and fill in your authentication information. Note that the requested password can also be your access token.
  4. 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:

  1. Create a GitHub personal access token with the public_repo box checked.
  2. Create a repository with that name on GitHub. Unlike Gitea, GitHub does not support creating repositories by pushing to the remote. You can also use an existing remote repo if it has the same commit history as your Gitea repo.
  3. In the settings of your Gitea repo, fill in the Git Remote Repository URL: https://github.com/<your_github_group>/<your_github_project>.git.
  4. Fill in the Authorization fields with your GitHub username and the personal access token as Password.
  5. (Optional, available on Gitea 1.18+) Select Sync when new commits are pushed so that the mirror will be updated as well as soon as there are changes. You can also disable the periodic sync if you like.
  6. 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:

  1. Create a GitLab personal access token with write_repository scope.
  2. Fill in the Git Remote Repository URL: https://<destination host>/<your_gitlab_group_or_name>/<your_gitlab_project>.git.
  3. Fill in the Authorization fields with oauth2 as Username and your GitLab personal access token as Password.
  4. 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:

  1. Create a Bitbucket app password with the Repository Write box checked.
  2. Fill in the Git Remote Repository URL: https://bitbucket.org/<your_bitbucket_group_or_name>/<your_bitbucket_project>.git.
  3. Fill in the Authorization fields with your Bitbucket username and the app password as Password.
  4. Select Add Push Mirror to save the configuration.

The repository pushes shortly thereafter. To force a push, select the Synchronize Now button.