Overview

bucket command guide

bucket is a command line application to interact with bitbucket.org.

Authentication

Explicit account

List all (public and private) JohnDoe repositories:

$ bucket --account JohnDoe:secret repo-ls

Default account

List all JohnDoe repositories:

$ bucket repo-ls

File ~/.bucket contains:

[accounts]
default = JohnDoe:secret

Selecting account by label

List all JackMay repositories. Note JackMay is not the default account:

$ bucket --account jack repo-ls

File ~/.bucket contains:

[accounts]
default = JohnDoe:secret
jack = JackMay:password

Inline password

Skip password in account specifications (--account of config file) to force bucket to ask you:

$ bucket --account JackMay: repo-ls
JackMay's password?

The same specification may be done in the config file:

[accounts]
default = JohnDoe:secret
jack = JackMay:

Anonymous access (no account)

List all public JohnDoe repositories:

$ bucket repo-ls JohnDoe

Without a ~/.bucket file

Configuration

bucket get preferences from the next places and priority (more to less):

  • command line arguments
  • config file specified at command line (--config argument)
  • ~/.bucket file
  • config.spec distribution file

Cloning

Clone a repository owned by the default configured account:

$ bucket repo-clone quake3

Clone any repository. Assume the repository is public or read access is granted for the configured default account:

$ bucket repo-clone JackMay/lemmings

Use SSH to clone the repo:

$ bucket repo-clone --ssh quake3

To specify SSH as default protocol write down next in your ~/.bucket file:

[repo-clone]
proto = ssh

SSH key management

Listing SSH keys:

$ bucket ssh-ls
pk:   32000 |  label: main-key  |  ssh-rsa AADFTYNseC2y ... ifd89kdjfalP john@storm
pk:   21456 |  label: job-key   |  ssh-rsa AADFTYNseC2y ... jfhdtsd76Kod john@hanzo

Uploading a key to the default account:

$ bucket ssh-add mykey ~/.ssh/mykey.pub
PK for the uploaded key: 12300

Remove a key (given its PK):

$ bucket ssh-del 32000

Selecting transport protocol

--http, --ssh

Selecting SCM

--ssh, --git

Repository syncing

clone/update given repositories to the specified directory. Useful for backup purposes, issue tracker integration, etc.

Sync all default account repositories:

$ bucket repo-sync --all

Sync 'quake3' and 'doom' repos to '/var/repos' directory:

$ bucket repo-sync quake3 doom --basedir /var/repos

The arguments basedir, all and proto may be set by config file as:

[repo-sync]
basedir = /wherever/you/want
all = True
proto = ssh

Using that configuration you may backup all your repos to /wherever/you/want using SSH transport just writing:

$ bucket repo-sync