Quick Start
Get productive with the Bitbucket CLI in under a minute.
TL;DR
npm install -g @pilatos/bitbucket-clibb auth login -u your-username -p your-api-tokenbb repo clone myworkspace/myrepobb pr create -t "My feature"Prerequisites
Before you begin, you’ll need:
- Node.js 20+ or Bun installed
- A Bitbucket Cloud account
- An API token (we’ll create one below)
Step-by-Step Setup
-
Install the CLI
Terminal window npm install -g @pilatos/bitbucket-cliVerify the installation:
Terminal window bb --version -
Create an API Token
- Go to Bitbucket API Tokens
- Click Create API token
- Name it (e.g., “bb CLI”)
- Select scopes:
- Account: Read
- Repositories: Read, Write
- Pull requests: Read, Write
- Click Create and copy the token
-
Authenticate
Terminal window bb auth loginEnter your Bitbucket username and the API token when prompted.
Verify it worked:
Terminal window bb auth status -
Clone a Repository
Terminal window bb repo clone myworkspace/myrepocd myrepo -
Create Your First PR
Terminal window git checkout -b feature/my-feature# Make some changes...git add .git commit -m "Add my feature"git push -u origin feature/my-featurebb pr create -t "Add my feature"
Common Commands
Here are the commands you’ll use most often:
| Command | Description |
|---|---|
bb pr list | List open pull requests |
bb pr view 42 | View PR #42 details |
bb pr create -t "Title" | Create a new PR |
bb pr merge 42 | Merge PR #42 |
bb pr checkout 42 | Checkout PR #42 locally |
bb pr diff 42 | View PR #42 diff |
bb repo list | List repositories |
Set a Default Workspace
If you work primarily in one workspace, set it as default:
bb config set workspace myworkspaceNow commands will use this workspace automatically:
bb repo list # Lists repos in "myworkspace"bb pr list -r myrepo # Lists PRs in "myworkspace/myrepo"Enable Tab Completion
Get intelligent tab completion for commands and options:
bb completion installRestart your shell, then try:
bb pr <Tab> # Shows: approve, checkout, create, decline, diff, list, merge, viewbb pr create -<Tab> # Shows available flagsNext Steps
You’re all set! Here’s where to go next:
- Command Reference - Full documentation for all commands
- Repository Context - How the CLI detects your workspace/repo
- Scripting & Automation - Use bb in scripts and CI/CD
- Troubleshooting - Common issues and solutions