You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

105 lines
3.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
3 years ago
5 years ago
3 years ago
5 years ago
3 years ago
  1. # Mirror your github repositories to your gitea server
  2. ## Badges
  3. [![image pulls](https://img.shields.io/docker/pulls/jaedle/mirror-to-gitea.svg)](https://cloud.docker.com/repository/docker/jaedle/mirror-to-gitea)
  4. [![microbadger analysis](https://images.microbadger.com/badges/image/jaedle/mirror-to-gitea.svg)](https://microbadger.com/images/jaedle/mirror-to-gitea "Get your own image badge on microbadger.com")
  5. ## Description
  6. `mirror-to-gitea` automatically creates repository mirrors from a Github User to your gitea server. The hard work (
  7. continous mirroring) is done by Gitea on a continuous basis.
  8. ### Modes
  9. There a different usage modes:
  10. 1. mirror **only public** repositories: No authentication on Github required. You may utilize an optional Github token
  11. to avoid rate limits
  12. 2. Mirror **public and private** repositories: Authentication for Github required.
  13. ### Prerequisites
  14. #### Mandatory
  15. - Something to mirror from Github (repositories from a Github user)
  16. - An application token for a gitea instance
  17. #### Optional
  18. - A Github token (to *avoid rate limits* or to *mirror private repositories*)
  19. ### Examples
  20. #### Mirror public repositories
  21. A github user `github-user` has the public repositories `dotfiles` and `zsh-config`. Starting the script with a gitea
  22. token for the account `gitea-user` will create the following mirror repositories:
  23. - github.com/github-user/dotfiles ← some-gitea.url/gitea-user/dotfiles
  24. - github.com/github-user/zsh-config ← some-gitea.url/zsh-config/dotfiles
  25. The mirror settings are default by your gitea instance.
  26. #### Mirror private repositories
  27. You obtained a github token for `github-user` which has a public repository `public-example` a private
  28. repository `private-example`. Running the mirroring process for `gitea-user` will create the following mirror
  29. repositories:
  30. - github.com/github-user/public-example ← some-gitea.url/gitea-user/public-example
  31. - github.com/github-user/private-example ← some-gitea.url/zsh-config/private-example
  32. The mirror settings are default by your gitea instance.
  33. ## Run public repository mirrors
  34. ### Parameters
  35. #### Mirror public repositories
  36. ##### Mandatory
  37. - `GITHUB_USERNAME` name of user with public repos should be mirrored
  38. - `GITEA_URL` url of your gitea server
  39. - `GITEA_TOKEN` token for your gitea user
  40. ##### Optional
  41. - `MIRROR_REPOSITORIES` `PUBLIC` (optional, is default)
  42. - `GITHUB_TOKEN` Github personal access token (optional to avoid rate limits)
  43. ```sh
  44. docker container run \
  45. -d \
  46. --restart always \
  47. -e MIRROR_REPOSITORIES='PUBLIC' \
  48. -e GITHUB_USERNAME='github-user' \
  49. -e GITHUB_TOKEN='<optional-github-token>' \
  50. -e GITEA_URL=https://some-gitea.url \
  51. -e GITEA_TOKEN='<gitea-token>' \
  52. jaedle/mirror-to-gitea:latest
  53. ```
  54. This will a spin up a docker container running infinite which will try to mirror all your repositories once every hour
  55. to your gitea server.
  56. ## Run private repository mirrors
  57. ##### Mandatory
  58. - `MIRROR_MODE` 'PRIVATE_AND_PUBLIC'
  59. - `GITHUB_TOKEN` Github personal access token
  60. - `GITEA_URL` url of your gitea server
  61. - `GITEA_TOKEN` token for your gitea user
  62. ```sh
  63. docker container run \
  64. -d \
  65. --restart always \
  66. -e MIRROR_MODE='PRIVATE_AND_PUBLIC' \
  67. -e GITHUB_TOKEN='<github-token>' \
  68. -e GITEA_URL=https://some-gitea.url \
  69. -e GITEA_TOKEN=please-exchange-with-token \
  70. jaedle/mirror-to-gitea:latest
  71. ```