As Gitea does not provide a simple way to modify the authorization information of mirrored repositories, I wrote this tool to solve this problem.
go install github.com/TBXark/gitea-mirror-reauth@latest
gitea-mirror-reauth
expected 'preview', 'auto-replace' or 'token-replace' subcommands
Usage:
preview preview all gitea repositories
auto-replace auto replace gitea repositories token by config
token-replace replace gitea repositories token manually
Check all the repositories in gitea-repositories and output the repository information
Usage of preview:
-gitea-dir string
gitea repositories dir (default "/home/git/data/gitea-repositories")
-help
help
Replace the token in the repository according to the configuration file
Usage of auto-replace:
-config string
config file path
-confirm
confirm
-gitea-dir string
gitea repositories dir (default "/home/git/data/gitea-repositories")
-help
help
Configuration file is json format, key is regular expression, value is new token.
{
"regex": "NEW_TOKEN",
"tbxark/private_repo_name": "NEW_PRIVATE_SCOPE_TOKEN",
"tbxark/.*": "NEW_PUBLIC_SCOPE_TOKEN"
}
Find all the tokens in the repository and replace them
Usage of token-replace:
-gitea-dir string
gitea repositories dir (default "/home/git/data/gitea-repositories")
-help
help
gitea-mirror-reauth is released under the MIT license. See LICENSE for details.