Get up and running with the Bitbucket CLI in a few minutes.
cd bb-cli
go build -o bb .Add the binary to your PATH, or run it directly:
./bb --help- Go to Bitbucket Settings > Personal access tokens
- Click Create token
- Give it a name (e.g.
bb-cli) - Grant at least: Pull requests: Read and write
- Copy the token (you won't see it again)
./bb auth loginYou'll be prompted for:
- Bitbucket username (email) — your Atlassian account email
- Bitbucket API token — the token you just created (input is hidden)
Credentials are saved to ~/.config/bb-cli/config.json.
Option A: Use flags
./bb pr list --workspace my-workspace --repo my-repoOption B: Edit the config file
Edit ~/.config/bb-cli/config.json:
{
"username": "you@example.com",
"token": "ATBB...",
"workspace": "my-workspace",
"repo": "my-repo"
}Option C: Run from a Bitbucket git repo
If you're inside a repo with a Bitbucket remote (e.g. git@bitbucket.org:workspace/repo.git), workspace and repo are detected automatically.
./bb pr list
./bb pr list --state MERGED
./bb pr list --state OPEN --limit 10./bb pr create --title "Add search feature" --source feat/search
./bb pr create -t "Fix login bug" -s fix/login --description "Fixes redirect issue"
./bb pr create -t "WIP: New API" -s feat/api --draft./bb pr view 123./bb pr comments 123
./bb pr comments 123 --limit 20./bb auth statusShows your logged-in user and stored workspace/repo.
| Problem | Solution |
|---|---|
not logged in |
Run bb auth login |
workspace is required |
Use --workspace and --repo, or set them in config, or run from a Bitbucket git repo |
API error (401) |
Token may be expired or revoked. Create a new token and run bb auth login again |
API error (404) |
Check that workspace and repo names are correct (case-sensitive) |