5 releases
0.2.3 | Dec 30, 2024 |
---|---|
0.2.2 | Dec 30, 2024 |
0.2.1 | Dec 29, 2024 |
0.2.0 | Dec 28, 2024 |
0.1.0 | Dec 28, 2024 |
#162 in Web programming
515 downloads per month
21KB
478 lines
gitbackup
Backup all your Git (Gitea, Forgejo, GitLab, GitHub) repositories with a single command.
How to install
cargo install gitbackup && gitbackup init
Config file
You can retrieve the config file location with the config
command. The file is constructed with the following
structure:
backup_path = "gitarchive"
[[providers]]
provider = "github"
host = "github.com"
exclude = ["facebook/react", "^google/"]
username = "MY_USERNAME"
token = "MY_GITHUB_TOKEN"
[[providers]]
provider = "gitlab"
host = "gitlab.com"
exclude = []
username = "MY_USERNAME"
token = "MY_GITLAB_TOKEN"
[[providers]]
provider = "forgejo"
host = "codeberg.org"
exclude = []
username = "MY_USERNAME"
token = "MY_FORGEJO_TOKEN"
The backup_path
field is the path where the repositories will be stored related to the user directory.
The providers
field is a list of providers to backup. Each provider has the following fields:
provider
: the provider of the repository (github
,gitea
,forgejo
,gitlab
are supported)host
: the host of the repository (e.g.: github.com, gitlab.com, codeberg.org, ... )exclude
: a list of repositories to exclude from the backup seperated by a comma (we can also use a regex)username
: your usernametoken
: your token
How to use
~ gitbackup help
gitbackup 0.1.0
Adrian Tombu <adrian@otso.fr>
Backup all your git repositories with a single command
Usage: gitbackup <COMMAND>
Commands:
init Initialize the config file
config Display the config file contents
run Run the backup
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
How to retrieve credentials
How to create a Github personal access token
- Go to https://github.com/settings/tokens (Settings -> Developer settings -> Personal access tokens -> Tokens ( classic))
- Click on the "Generate new token" button
- Click on the "repo - Full control of private repositories" checkbox
- Click on the "Generate token" button
- Save your newly generated token on a safe place, this will be the last time it is shown to you
How to create a GitLab personal access token
- Go to https://gitlab.com/-/user_settings/personal_access_tokens (Settings -> Access tokens)
- Click on the "Add new token" button
- Click on the "read_api" checkbox
- Click on the "Create personal access token" button
- Save your newly generated token on a safe place, this will be the last time it is shown to you
How to create a Gitea / Forgejo personal access token
There can be many instances of Gitea / Forgejo so here we will use Codeberg as an example.
- Go to https://codeberg.org/user/settings/applications (Settings -> Applications)
- Give a name to your token, and click on "Select permissions"
- Select "Read" in the "Organization", "Repository" and "User" sections
- Click on the "Generate token" button
- Save your newly generated token on a safe place, this will be the last time it is shown to you
Dependencies
~15–30MB
~528K SLoC