Skip to content

Conversation

@aft
Copy link

@aft aft commented Nov 18, 2025

Problem

Bitbucket Cloud repository cloning was failing with authentication errors. The root cause was a mismatch between the credential formats required by different Bitbucket operations:

  • Bitbucket API calls require the full email address (e.g., user@example.com)
  • Git clone operations require only the username portion (e.g., user)

Previously, the code was passing the full email address to git clone URLs, causing authentication failures like:

fatal: Authentication failed for 'https://bitbucket.org/workspace/repo.git'

Solution

Extract the username from the configured email address when building git clone URLs for Bitbucket repositories. The fix uses JavaScript's split('@')[0] to extract the username portion while maintaining the full email for API authentication.

The getAuthCredentialsForRepo function in utils.ts was updated to handle Bitbucket's specific authentication requirements:

  1. The full email from config.user is preserved for API operations
  2. Only the username portion is used when constructing the cloneUrlWithToken
  3. The username is passed to createGitCloneUrlWithToken which builds the authenticated URL format: https://username:token@bitbucket.org/...

Testing

  • ✅ Verified with Bitbucket Cloud repositories
  • ✅ Confirmed successful authentication and repository cloning

Related Issues

Fixes #573 - Sourcebot not indexing branches for bitbucket

@coderabbitai
Copy link

coderabbitai bot commented Nov 18, 2025

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@aft aft marked this pull request as ready for review November 18, 2025 21:26
@brendan-kellam
Copy link
Contributor

To sanity check, will this break Bitbucket server?

const username = config.user ?? 'x-token-auth';
// Extract username from email if present (e.g., user@example.com -> user)
// Bitbucket API auth uses the full email, but git clone needs just the username
const username = config.user
Copy link
Contributor

@brendan-kellam brendan-kellam Nov 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To my other comment, I'm not sure if this will break bitbucket server. Might be best to only do this if config.deploymentType is cloud

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, but I can’t confirm whether it breaks Bitbucket Server or not. I only have access to Cloud.

If no one can verify it, making it conditional might be better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Sourcebot not indexing branches for bitbucket

2 participants