Tool to backup your git repositories to a git provider.
Omnigit is a tool that automatically backs up multiple repositories from one git provider to another. The tool will ask you which providers you want to backup the repositories too. Furthermore, it will search for all the repositories to back up in a path given by the user.
The below images follow this flow:
- Ask in which git providers we must create the backups
- Ask which repositories to backup.
- Show the “configuration” and ask the user if they want to proceed.
If all went well, the tool creates the backups. From now on, whenever you do a push, all git providers will receive the update.
- GitHub and GitLab are supported by default.
- Git providers easily extensible (add new providers to git_providers.sh).
- Only needs to run once.
Clone this repository in your machine.
git clone [email protected]:danielorihuela/omnigit.git
Omnigit has two preconditions.
- You need to have an account on the git provider you want to use.
- You need to have configured an SSH key for the git provider.
If that is already the case, you can proceed. Otherwise, please check how to generate an ssh key and how to add a new SSH key to the provider. GitHub for example, provides us the following documentation.
You can run Omnigit with the following command:
./omnigit "directory absolute path"
Do not use a relative path. The tool is not going to work.
Good example
./omnigit ~/Desktop
Bad example
./omnigit ../
If you want to call Omnigit from anywhere on your computer, you can configure an alias.
In Bash would be something like:
# alias omnigit='export PATH=$PATH:"repository path" && "repository path"/omnigit.sh'
alias omnigit='export PATH=$PATH:~/Desktop/Side-Projects/omnigit && ~/Desktop/Side-Projects/omnigit/omnigit.sh'
- If the git repository is local (i.e. the code is not in GitHub, GitLab or any other git provider), the “main” git provider will be the first provider, from the ones that you selected from the list, in order of appearance. E.g. if the list of git providers is GitHub, GitLab and Bitbucket, in that order, and you selected GitHub and Bitbucket. The “main” git provider will be GitHub.
By “main”, we mean that when you execute
git pull
, it will download the code from that specific provider. That is something relevant. If that provider has an outage, you will need to do some manual steps to pull the code from another git provider. - The repository is pushed to the git provider with the default configuration of that provider. For example, by default, GitLab creates private repositories where the
main
branch is protected, i.e. you cannot force a push. If you require further configuration, this tool does not provide it.
Feel free to improve that project by yourself and create a PR.