8000 GitHub - plembo/gitbackup at v0.1
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

plembo/gitbackup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gitbackup - Backup your GitHub and GitLab repositories

Build Status

gitbackup is a tool to backup your git repositories from GitHub (including GitHub enterprise) or GitLab (including custom GitLab installations).

gitbackup only creates a backup of the repository and does not currently support issues, pull requests or other data associated with a git repository. This may or may not be in the future scope of this tool.

If you are following along my Linux Journal article, please obtain the version of the source tagged with lj-0.1.

Using gitbackup

Binary releases will be available soon. For now, you will have to clone this repository and build gitbackup.

gitbackup requires a GitHub API access token for backing up GitHub repositories and GitLab personal access token for GitLab. You can supply the token to gitbackup using GITHUB_TOKEN and GITLAB_TOKEN respectively.

Typing -help will display the command line options that gitbackup recognizes:

./bin/gitbackup -help
Usage of ./bin/gitbackup:
  -backupdir string
    	Backup directory
  -githost.url string
    	DNS of the custom Git host
  -github.repoType string
    	Repo types to backup (all, owner, member) (default "all")
  -gitlab.projectVisibility string
    	Visibility level of Projects to clone (default "internal")
  -service string
    	Git Hosted Service Name (github/gitlab)

Backing up your GitHub repositories

To backup all your GitHub repositories to the default backup directory ($HOME/.gitbackup/):

$ GITHUB_TOKEN=secret$token gitbackup -service github

To backup only the GitHub repositories which you are the "owner" of:

$ GITHUB_TOKEN=secret$token gitbackup -service github -github.repoType owner

To backup only the GitHub repositories which you are the "member" of:

$ GITHUB_TOKEN=secret$token gitbackup -service github -github.repoType member

Backing up your GitLab repositories

To backup all projects which have their visibility set to "internal" on https://gitlab.com to the default backup directory ($HOME/.gitbackup/):

$ GITLAB_TOKEN=secret$token gitbackup -service gitlab

To backup only the GitLab projects which are "public"

$ GITLAB_TOKEN=secret$token gitbackup -service gitlab -gitlab.projectVisibility public

To backup only the private repositories:

$ GITLAB_TOKEN=secret$token gitbackup -service gitlab -gitlab.projectVisibility private

GitHub Enterprise or custom GitLab installation

To specify a custom GitHub enterprise or GitLab location, specify the service as well as the the githost.url flag, like so

$ GITLAB_TOKEN=secret$token gitbackup -service gitlab -githost.url https://git.yourhost.com

Specifying a backup location

To specify a custom backup directory, we can use the backupdir flag:

$ GITHUB_TOKEN=secret$token gitbackup -service github -backupdir /data/

This will create a github.com directory in /data and backup all your repositories there instead. Similarly, it will create a gitlab.com directory, if you are backing up repositories from gitlab. If you have specified a Git Host URL, it will create a directory structure data/host-url/.

Building

Setup Golang 1.8 and gb following my blog post here and then:

$ gb build 

The built binary will be in bin/gitbackup.

About

Tool to backup your Bitbucket, GitHub and GitLab repositories

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%
0