# Bitbucket CLI
[](https://github.com/pegasusheavy/bitbucket-cli/actions/workflows/ci.yml)
[](https://github.com/pegasusheavy/bitbucket-cli/releases)
[](https://crates.io/crates/bitbucket-cli)
[](https://opensource.org/licenses/MIT)
A powerful command-line interface for Bitbucket Cloud. Manage repositories, pull requests, issues, and pipelines directly from your terminal.
## ✨ Features
- 📁 **Repository Management** - List, view, clone, create, manage repositories, and upload/manage downloads
- 🔀 **Pull Requests** - Create, review, merge, approve, and manage PRs
- 🐛 **Issue Tracking** - Create, view, comment on, and manage issues
- ⚡ **Pipelines** - Trigger, monitor, and manage CI/CD pipelines
- 🖥️ **Interactive TUI** - Beautiful terminal UI for browsing and managing resources
- 🔐 **Secure Authentication** - OAuth 2.0 preferred, API key fallback, with secure keyring storage
## 📦 Installation
### Using Cargo (Recommended)
```bash
cargo install bitbucket-cli
```
### Debian/Ubuntu
```bash
# Download the .deb package from releases
wget https://github.com/pegasusheavy/bitbucket-cli/releases/latest/download/bitbucket-cli_amd64.deb
sudo dpkg -i bitbucket-cli_amd64.deb
```
### Red Hat/Fedora/CentOS
```bash
# Download the .rpm package from releases
wget https://github.com/pegasusheavy/bitbucket-cli/releases/latest/download/bitbucket-cli.x86_64.rpm
sudo rpm -i bitbucket-cli.x86_64.rpm
# or with dnf
sudo dnf install bitbucket-cli.x86_64.rpm
```
### Arch Linux
```bash
# Recommended: download the PKGBUILD from releases and build the package
wget https://github.com/pegasusheavy/bitbucket-cli/releases/latest/download/PKGBUILD
makepkg -si
# Or download the binary tarball and extract it manually
wget https://github.com/pegasusheavy/bitbucket-cli/releases/latest/download/bitbucket-cli-vX.X.X-x86_64-linux.tar.zst
tar --zstd -xf bitbucket-cli-vX.X.X-x86_64-linux.tar.zst
sudo mv bitbucket /usr/local/bin/
```
### Alpine Linux
```bash
# Download the tarball from releases
wget https://github.com/pegasusheavy/bitbucket-cli/releases/latest/download/bitbucket-cli-vX.X.X-alpine-x86_64.tar.gz
tar -xzf bitbucket-cli-vX.X.X-alpine-x86_64.tar.gz
sudo mv bitbucket /usr/local/bin/
```
### Windows
Download the MSI installer from the [Releases](https://github.com/pegasusheavy/bitbucket-cli/releases) page and run it.
### From Source
```bash
git clone https://github.com/pegasusheavy/bitbucket-cli.git
cd bitbucket-cli
cargo install --path .
```
### Pre-built Binaries
Download pre-built binaries for your platform from the [Releases](https://github.com/pegasusheavy/bitbucket-cli/releases) page.
## 🚀 Quick Start
### 1. Authenticate
**Option A: OAuth 2.0 (Recommended)**
```bash
bitbucket auth login --oauth
```
You'll need to create an OAuth consumer first:
1. Go to your [Bitbucket workspace settings](https://bitbucket.org/[workspace]/workspace/settings/oauth-consumers/new)
2. Set callback URL to **ONE** of these (the CLI will use the first available):
- `http://127.0.0.1:8080/callback`
- `http://127.0.0.1:3000/callback`
- `http://127.0.0.1:8888/callback`
- `http://127.0.0.1:9000/callback`
3. Select permissions:
- Account (Read)
- Repositories (Read)
- Pull requests (Read, Write)
- Issues (Read, Write)
- Pipelines (Read, Write)
4. Copy the Key (Client ID) and Secret when prompted
**Option B: API Key (For CI/Automation)**
```bash
bitbucket auth login --api-key
```
You'll need to create an API token:
1. Go to your [Bitbucket personal settings](https://bitbucket.org/account/settings/) and open the API tokens section
2. Create a new token with the required permissions
3. Enter your Atlassian account email and token when prompted (or pass `--email` and `--token` for non-interactive use)
**Note:** App passwords are deprecated by Atlassian. OAuth 2.0 is the preferred method.
### 2. Start Using
```bash
# List repositories
bitbucket repo list myworkspace
# View a repository
bitbucket repo view myworkspace/myrepo
# List pull requests
bitbucket pr list myworkspace/myrepo
# Create a pull request
bitbucket pr create myworkspace/myrepo --title "My PR" --source feature-branch
# Upload a file (e.g. a screenshot) to the repo downloads area, then
# reference the printed URL from a PR description or comment as 
bitbucket repo download upload myworkspace/myrepo screenshot.png
# Launch interactive TUI
bitbucket tui --workspace myworkspace
```
### Scripting
Every command accepts a global `--output` flag. The default (`table`) prints
human-readable tables; `--output json` emits the raw data as pretty-printed
JSON for piping into `jq` or scripts:
```bash
# IDs and titles of open pull requests
# Machine-readable repository details
bitbucket repo view myworkspace/myrepo --output json
```
## 📖 Commands
| `bitbucket auth` | Manage authentication (login, logout, status) |
| `bitbucket repo` | Manage repositories (list, view, clone, create, update, move, fork, delete, watchers, forks, downloads), plus branch/tag/commit/file browsing, webhooks, branch restrictions, default reviewers, permissions, deploy keys, environments, deployments, and the branching model |
| `bitbucket pr` | Manage pull requests (list, view, create, edit, merge, approve/unapprove, request-changes, decline, checkout, diff/diffstat, patch, commits, statuses, activity, pipelines), plus comments and tasks |
| `bitbucket issue` | Manage issues (list, view, create, edit, delete, close, reopen, vote, watch), plus comments, attachments, change log, and tracker components/milestones/versions |
| `bitbucket pipeline` | Manage pipelines (list, view, trigger, rerun, stop, config), plus repository and workspace variables, schedules, and caches |
| `bitbucket workspace` | Manage workspaces (list, view, members, permissions) and their projects |
| `bitbucket user` | Inspect user accounts (whoami, view, emails) |
| `bitbucket tui` | Launch interactive terminal UI |
## 🖥️ TUI Mode
Launch the interactive terminal UI for a visual way to browse and manage your Bitbucket resources:
```bash
bitbucket tui
```
**Keyboard shortcuts:**
- `q` - Quit
- `1-5` - Switch views (Dashboard, Repos, PRs, Issues, Pipelines)
- `j/k` or `↑/↓` - Navigate
- `Enter` - Select (opens the view on Dashboard)
- `r` - Refresh
## ⚙️ Configuration
Configuration is stored in `~/.config/bitbucket-cli/config.toml`:
```toml
[auth]
username = "your-username"
default_workspace = "your-workspace"
[display]
color = true
pager = true
```
`[defaults] workspace` is still read as a legacy fallback for the default workspace; `[auth] default_workspace` takes precedence.
## 📚 Documentation
Full documentation is available at [pegasusheavy.github.io/bitbucket-cli](https://pegasusheavy.github.io/bitbucket-cli/)
## 🤝 Contributing
Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) for details.
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## 📄 License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## 💖 Support
If you find this project useful, please consider:
- ⭐ Starring the repository
- 🐛 Reporting bugs
- 💡 Suggesting features
- 💰 [Supporting on Patreon](https://www.patreon.com/c/PegasusHeavyIndustries)
---
Made with ❤️ by [Pegasus Heavy Industries](https://github.com/pegasusheavy)