fix: pass original URL with credentials to sync_refs for private repos#4483
Open
octo-patch wants to merge 1 commit intoTabbyML:mainfrom
Open
fix: pass original URL with credentials to sync_refs for private repos#4483octo-patch wants to merge 1 commit intoTabbyML:mainfrom
octo-patch wants to merge 1 commit intoTabbyML:mainfrom
Conversation
Private repositories authenticated via URL (e.g. Bitbucket, GitLab subgroups) were silently losing their credentials before the git clone/pull command ran. `CodeRepository::sync()` was calling `self.canonical_git_url()` which strips the username and password, causing git to fail with "could not read Username ... No such device or address". - In `tabby-index`: pass `self.git_url` (original URL) to `sync_refs` instead of the credential-stripped `canonical_git_url()`. - In `tabby-git`: add `mask_url_credentials()` helper to safely redact credentials in log output, and call `git remote set-url` on existing clones so credential changes in config take effect without a full re-clone. Fixes TabbyML#4434, TabbyML#4431
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Private repositories configured with authentication credentials in the URL (e.g. Bitbucket, GitLab repositories in subgroups) fail to clone or pull with errors like:
The root cause is in
CodeRepository::sync()— it callsself.canonical_git_url()which strips the username and password from the URL before passing it tosync_refs(). So the git clone/pull command runs without credentials.Fixes #4434, closes #4431.
Changes
crates/tabby-index/src/code/repository.rsself.git_url(original URL with credentials) tosync_refsinstead ofself.canonical_git_url().crates/tabby-git/src/lib.rsmask_url_credentials()helper that strips credentials for safe log output.sync_refsto use the masked URL so credentials are never exposed in logs.elsebranch), callgit remote set-url origin <url>so credential changes in the config take effect without a full re-clone.Testing
The directory name for cloned repos is derived from the canonical URL (no credentials), which is correct — this ensures the directory stays stable even when credentials change. The fix ensures only the git commands receive the full URL with credentials while logs always see the masked version.