Skip to content

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

git-backup

Various scripts to backup git repositories

Create an own script using these backup scripts. Run this script manually or use cron:

crontab -e

add for once a day:

05***/home/user/bin/mybackup_script

Example script

#!/bin/sh# backup my git repositories# backup gitoliteecho"#### HOST: gitolite.example.com"
backup-gitolite "git@gitolite.example.com""backup_gitolite_example_com/"# backup gitlabecho"#### HOST: gitolab.example.com"
backup-gitlab "gitlab.example.com""1234TOKENABC""backup_gitlab_example_com/"# backup githubecho"#### HOST: github.example.com"
backup-github simonwalz "backup_github_com/"

Usage: backup-git-repo

Backup a git repository by its repository url:

backup-git-repo REPO_URL LOCAL_PATH
Options
OptionDescription
REPO_URLFull repository URL
LOCAL_PATHLocal directory to save the git repository in. Can be a bare or a non-bare repository. Creates a bare repository if directory does not exist.

Usage: backup-github

Backup all public git repositories of a GitHub user:

backup-github GITHUB_USER LOCAL_PATH_PREFIX [EXCLUDE_REPOS]
Options
OptionDescription
GITHUB_USERYour GitHub username
LOCAL_PATH_PREFIXLocal directory prefix to save the git repositories in. If prefix ends on a `/` a separate directory is created.
EXCLUDE_REPOS(optional) Repositories to ignore. Use an extended regular expression to match repositories. E.g. '^Repo A$|^Repo B$'

Usage: backup-gitlab

Backup all git repositories of a GitLab user:

backup-gitlab GITLAB_HOST GITLAB_TOKEN LOCAL_PATH_PREFIX [EXCLUDE_REPOS] [GITLAB_HTTP_PROTO] [FETCH_PROTO] [GITLAB_USER] [CURL_OPTS]
Options
OptionDescription
GITLAB_HOSTPure hostname of the gitlab server. E.g. gitlab.example.com
GITLAB_TOKENA GitLab API token. See GitLab Dokumentation
LOCAL_PATH_PREFIXLocal directory prefix to save the git repositories in. If prefix ends on a `/` a separate directory is created.
EXCLUDE_REPOS(optional) Repositories to ignore. Use an extended regular expression to match repositories. E.g. '^Repo A$|^Repo B$'
GITLAB_HTTP_PROTO(optional) HTTP proto to use: https (default) or http
FETCH_PROTO(optional) Protocol to use for fetching the repositories: ssh (default), https or http
FETCH_USER(optional) Username to use for fetching the repositories.
Default for SSH: git
Default for HTTP: user
CURL_OPTS(optional) Additional curl command line options. E.g. '-u user:pass' for an additional HTTP BASIC authentication

Usage: backup-gitolite

Backup all git repositories of a Gitolite:

backup-gitolite GITOLITE_HOST LOCAL_PATH_PREFIX [EXCLUDE_REPOS]
Options
OptionDescription
GITOLITE_HOSTUsername and hostname of the gitolite server. E.g. git@gitolite.example.com
LOCAL_PATH_PREFIXLocal directory prefix to save the git repositories in. If prefix ends on a `/` a separate directory is created.
EXCLUDE_REPOS(optional) Repositories to ignore. Use an extended regular expression to match repositories. E.g. '^Repo A$|^Repo B$'

About

Various scripts to backup git repositories (github, gitlab, gitolite)

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages