gitbak - bitbucket/github/gist backup
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
.gitignore
.yardopts
README.md
gitbak.gemspec

README.md

File        : README
Maintainer  : Felix C. Stegerman <flx@obfusk.net>
Date        : 2014-10-29

Copyright   : Copyright (C) 2014  Felix C. Stegerman
Version     : v0.5.2

Gem Version

Description

gitbak - bitbucket/github/gist backup

GitBak mirrors Bitbucket/GitHub/Gist repositories; paths, users, and other options are specified in ~/.gitbak.

When run, gitbak:

  • asks for passwords;
  • lists repositories using APIs - authenticating if necessary;
  • clones/updates repositories;
  • shows a summary (if verbose)

Usage

$ gitbak --help                                     # show options
$ vim ~/.gitbak                                     # configure
$ gitbak --no-act                                   # dry run
$ gitbak -v                                         # mirror
$ time gitbak -v 2>&1 | tee "$(date +%Y%m%d)".log   # w/ logfile

Installing

$ gem install gitbak                                # rubygems

Get it at https://github.com/obfusk/gitbak. Depends: git, ruby.

Configuration

Example

# ~/.gitbak
dir = "#{ Dir.home }/__mirror__/#{ Time.new.strftime '%Y%m%d' }"
%w{ bob alice }.each do |u|
  bitbucket  "#{dir}/#{u}/bitbucket", user: u
  github     "#{dir}/#{u}/github"   , user: u, token: true
  gist       "#{dir}/#{u}/gist"     , user: u, auth: :github
end

Methods

bitbucket repo #, options...
github    repo #, options...
gist      repo #, options...

Options

user:   "username"    # mandatory
token:  true          # use token instead of user/pass (default: false)
auth:   false         # use authentication (default: true);
                      # use :github w/ gist to re-use github auth
method: :https        # clone method (default: :ssh);
                      # NB: https auth not implemented yet

TODO

Some things that may be useful/implemented at some point.

  • gitlab w/ groups & server
  • github organisations
  • bitbucket teams

  • ask password again on typo (^D) or auth fail
  • tests?
  • better error handling?
  • use obfusk-util (for prompt etc.)?

  • custom services (should be easy to add already)
  • metadata (issues, wikis, ...)
  • teams/organisations
  • starred repos/gists
  • filtering
  • oauth?

  • specify ssh key(s)?
  • https clone auth?

License

GPLv3+ [1].

References

[1] GNU General Public License, version 3 --- http://www.gnu.org/licenses/gpl-3.0.html