Fix extension handling of git URL aliasing in config#8245
Merged
Conversation
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot stopped work on behalf of
alexr00 due to an error
December 9, 2025 12:12
alexr00
requested changes
Dec 18, 2025
- Add resolveGitUrl function to resolve git URL aliases (e.g., "gh:" -> "git@github.com:") - Add parseRepositoryRemotesAsync function to parse remotes with alias resolution - Update computeAllUnknownRemotes and computeAllGitHubRemotes to use async parsing - Fixes issue where extension mistakenly thinks user is using GH Enterprise with git URL aliasing Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Contributor
Author
I've implemented git URL alias resolution to fix the issue. The changes include:
This resolves the issue where URLs like Commit: 310b8a5 |
Co-authored-by: alexr00 <38270282+alexr00@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix extension handling of GH aliasing in git config
Fix extension handling of git URL aliasing in config
Dec 18, 2025
alexr00
approved these changes
Dec 18, 2025
dbaeumer
approved these changes
Dec 18, 2025
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.
Fixes the issue where the extension mistakenly thinks users are using GitHub Enterprise when they have git URL aliasing configured in their
.gitconfig.Problem
Users with git URL aliases like:
Would see the error:
The extension was receiving aliased URLs (e.g.,
gh:user/private) from the git extension but wasn't resolving them to their actual URLs (e.g.,git@github.com:user/private), causing incorrect GitHub Enterprise authentication attempts.Solution
This PR implements git URL alias resolution by:
resolveGitUrlfunction - Reads git config to findurl.*.insteadOfentries and applies URL substitutionsparseRepositoryRemotesAsync- New async version of remote parsing that resolves git URL aliases before parsingcomputeAllUnknownRemotes()andcomputeAllGitHubRemotes()to use the new async parsingThe extension now correctly:
Changes Made
src/common/remote.ts: Added URL resolution logic and async remote parsingsrc/github/folderRepositoryManager.ts: Updated to use async remote parsing for GitHub detectionThe original synchronous
parseRepositoryRemotesfunction remains unchanged for backward compatibility with call sites that don't require alias resolution.Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.