gitbackup-0.2.1 is not a library.
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:
= "gitarchive"
[[]]
= "github"
= "github.com"
= ["facebook/react", "^google/"]
= "MY_USERNAME"
= "MY_GITHUB_TOKEN"
[[]]
= "gitlab"
= "gitlab.com"
= []
= "MY_USERNAME"
= "MY_GITLAB_TOKEN"
[[]]
= "forgejo"
= "codeberg.org"
= []
= "MY_USERNAME"
= "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