Diagnosing Sourcetree Authentication Failures with Bitbucket Cloud
Step‑by‑step guide to diagnose and fix Sourcetree’s repeated Bitbucket authentication failures caused by expired, revoked, or duplicated OAuth tokens.
05 Jul 2026, 12:59 UTC

Recognizable condition
Sourcetree repeatedly shows a login dialog for Bitbucket Cloud, rejects correct username/password, and displays an "Authentication failed" message. Fetch, push, and pull operations do not complete.
Cause and diagnostic table
| Symptom | Likely cause | Quick check |
|---|---|---|
| Login prompt loops after correct credentials | Expired or revoked OAuth token | View token status in Bitbucket → Personal settings → App passwords/OAuth tokens |
| No remote operations after login | Cached token mismatch or duplicate account entries | Open Sourcetree → Tools → Options → Accounts and look for multiple Bitbucket entries |
| Error message "Invalid token" | Token revoked or stale token stored in OS credential manager | Check Bitbucket audit log for token revocation; inspect Windows Credential Manager or macOS Keychain for "bitbucket.org" entries |
Ordered checks
- Open Sourcetree, go to Tools → Options → Accounts, select the Bitbucket account and click Edit. Note whether the token field is populated.
- If a token is shown, log into the Bitbucket web UI, navigate to Personal settings → App passwords/OAuth tokens, and verify the token’s status (active, expired, or revoked).
- If the token is missing, marked expired/revoked, or you see duplicate Bitbucket entries, delete the account entry in Sourcetree (Accounts → select account → Remove).
- Re‑add the Bitbucket account via Clone / Add new repository → Bitbucket Cloud → Sign in with Bitbucket. Complete the OAuth flow.
- After re‑authentication, select a repository, open the Remotes view, and run a Fetch operation.
Fixes tied to findings
Expired or revoked token
Removing the old account and re‑adding it forces Sourcetree to obtain a fresh OAuth token. Do not edit the token field manually; the internal store must be cleared.
Duplicate or conflicting tokens
Delete all Bitbucket entries in the Accounts preferences, then add a single account again. This eliminates confusion caused by multiple cached tokens.
Stale token in OS credential store
On Windows, open Credential Manager → Windows Credentials, locate the generic credential for bitbucket.org (or atlassian.com), and remove it. On macOS, open Keychain Access, search for "bitbucket", and delete the matching password item. After clearing, repeat the re‑addition steps.
Escalation criteria
If authentication still fails after the above steps:
- Verify that no network proxy or firewall is blocking HTTPS traffic to
bitbucket.org. - Ensure Sourcetree is updated to the latest version (≥ 4.2.x).
- Collect diagnostic logs via Help → Show Logs and capture a screenshot of the Accounts dialog.
- Submit a support ticket to Atlassian with the logs and screenshot.
Limitations and verification
Clearing the OS credential store may affect other Atlassian tools (e.g., Jira, Bamboo) that rely on the same stored credentials; note existing entries before removal.
Practical verification: after re‑adding the account, a successful fetch updates the Last used timestamp in the Accounts dialog and retrieves the latest commits in the repository’s history.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.