Configuration File
The Bitbucket CLI stores configuration in a JSON file. This page documents the file format, location, and available settings.
File Location
~/.config/bb/config.json%APPDATA%\bb\config.jsonTypically: C:\Users\<username>\AppData\Roaming\bb\config.json
Configuration Schema
| Key | Type | Description | Set By |
|---|---|---|---|
username | string | Your Bitbucket username | bb auth login |
apiToken | string | Your API token (stored securely) | bb auth login |
workspace | string | Default workspace | bb config set |
repo | string | Default repository | bb config set |
Example Configuration
{ "username": "myuser", "apiToken": "ATBB_xxxxxxxxxxxxxxxxxxxx", "workspace": "myworkspace", "repo": "myrepo"}Managing Configuration
View All Settings
bb config listOutput:
Configuration file: /Users/you/.config/bb/config.json
Key Valueusername myuserapiToken ********workspace myworkspacerepo myrepoGet a Specific Value
bb config get workspace# Output: myworkspaceSet a Value
bb config set workspace myworkspacebb config set repo myrepoProtected Keys
Some configuration keys cannot be set directly:
| Key | Reason | How to Set |
|---|---|---|
username | Tied to authentication | Use bb auth login |
apiToken | Security-sensitive | Use bb auth login |
Configuration Precedence
When determining workspace and repository, the CLI checks sources in this order:
-
Command-line flags (highest priority)
Terminal window bb pr list -w otherworkspace -r otherrepo -
Git repository remote (if in a git repo)
Terminal window cd /path/to/cloned-repobb pr list # Uses workspace/repo from git remote -
Configuration file (lowest priority)
Terminal window bb config set workspace myworkspacebb pr list # Uses config default
See Understanding Repository Context for detailed examples.
File Permissions
The configuration file contains sensitive data (API token). The CLI sets appropriate permissions automatically:
| Platform | Permissions |
|---|---|
| macOS/Linux | 0600 (owner read/write only) |
| Windows | Inherits user profile permissions |
Reset Configuration
Clear Authentication Only
bb auth logoutThis removes username and apiToken but keeps workspace and repo settings.
Full Reset
Delete the configuration file entirely:
rm ~/.config/bb/config.jsonRemove-Item $env:APPDATA\bb\config.jsonThen re-authenticate:
bb auth loginTroubleshooting
”Cannot read config file”
The file may be corrupted. Delete and recreate it:
rm ~/.config/bb/config.jsonbb auth login“Cannot write config file”
Check directory permissions:
ls -la ~/.config/bb/Create the directory if it doesn’t exist:
mkdir -p ~/.config/bbConfig Not Being Used
Verify the CLI is reading from the expected location:
bb config list# Check the "Configuration file:" lineRemember that command-line flags and git context take precedence over config file settings.