Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git - extension API gives repository remotes with aliases #174941

Open
alexr00 opened this issue Feb 21, 2023 · 3 comments · May be fixed by #238675
Open

Git - extension API gives repository remotes with aliases #174941

alexr00 opened this issue Feb 21, 2023 · 3 comments · May be fixed by #238675
Assignees
Labels
feature-request Request for new features or functionality git GIT issues
Milestone

Comments

@alexr00
Copy link
Member

alexr00 commented Feb 21, 2023

From @ashb in microsoft/vscode-pull-request-github#4551:

I have the following lines in my ~/.gitconfig:

[url "https://github.com/"]
  insteadOf = "github:"
  pushInsteadOf = "[email protected]:"
[url "[email protected]:"]
  insteadOf = "gh:"
  pushInsteadOf = "github:"
  pushInsteadOf = "git://github.com/"

(The effect is that I can do git clone github:user/public or git clone gh:user/private)

However I think the extension is getting confused about the gh: prefix and not reflecting my global git config.

For example, on such a private repo:

$ git config remote.origin.url
gh:user/private
$ git remote get-url origin
[email protected]:user/private

$ git remote show origin -n
* remote origin
  Fetch URL: [email protected]:user/private
  Push  URL: [email protected]:user/private

When using the git extension API to get information about a repo that's been set up like this, the repository's remote doesn't have a meaningful url:
image

I don't see a way to resolve this URL to something meaningful using the git extension API. I think ideally the git extension API would resolve the fetch and push URLs instead of using the aliases.

@alexr00 alexr00 added this to the April 2023 milestone Mar 21, 2023
@alexr00 alexr00 modified the milestones: April 2023, May 2023 Apr 26, 2023
@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug feature-request Request for new features or functionality git GIT issues and removed bug Issue identified by VS Code Team member as probable bug labels Apr 26, 2023
@lszomoru lszomoru modified the milestones: May 2023, Backlog May 26, 2023
@ecker-deshaw
Copy link

As a data point, I ran into this issue today in VS Code while working on a repo I had cloned using an "insteadOf" alias. For context, I am using url.https://github.<corp>.com/.insteadof=github: so I can clone similarly with git clone github:<org>/<repo> against a GitHub Enterprise Server (on-prem) instance.

@d-b-w
Copy link

d-b-w commented Jan 30, 2024

This irrevocably breaks any repo that was cloned with insteadOf. Even after I setting an upstream, vscode-pull-request-github was toast and kept trying to auth against my non-existent corporate repo

@lszomoru lszomoru changed the title Git extension API gives repository remotes with aliases Git - extension API gives repository remotes with aliases Dec 10, 2024
@wafrelka
Copy link

@alexr00 @lszomoru I really hope this gets fixed! If you are open to external contributions, I would like to submit a pull request from https://github.com/wafrelka/vscode/tree/issue174941.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality git GIT issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants