vscode-pull-request-github
vscode-pull-request-github copied to clipboard
Fetching pull requests for remote 'origin' failed, please check if the url . . . is valid
Issue template says
Use Help > Report Issue to prefill these.
Unfortunately, it pre-filled nothing, but created a new issue in microsoft/vscode rather than here. I had to fill out everything myself: https://github.com/microsoft/vscode/issues/143344
- GitHub Pull Requests Extension version: v0.36.2
- VSCode Version: 1.64.2
- OS: macOS Monterey 12.2.1
Steps to Reproduce:
- Start VSCode and open directory that contains project cloned from (in this case) GitHub Enterprise
- Synchronize with the server, and observe the error in the issue title: "Fetching pull requests for remote 'origin' failed, please check if the url . . . is valid"
This happens when the remote URL is in form of ssh://git@repo-host/user-id/repo-name.git.
Changing it to https://user-id:access-token@repo-host/user-id/repo-name.git is a workaround, but for this repo I need SSH-based access.
@mouse07410 thank you for creating an issue in this repo!
This extension's GitHub Enterprise support is maintained by the community, but I can tell you that the error Fetching pull requests for remote 'origin' failed, please check if the url . . . is valid is shown when we get a 404 back. You might try signing out of your account in VS Code, reloading VS Code, then signing in again.
If that works, I can add a force re-auth when we get this error for GitHub Enterprise.
the error
Fetching pull requests for remote 'origin' failed, please check if the url . . . is validis shown when we get a 404 back
Only in that case?
When I'm in VSCode terminal tab, git works fine. Also, just now I got an error
Fetching pull requests for remote 'origin' failed, please check if the url https:/<user-id>:/<user-auth-token>@github.mit.edu/<user-id>/<repo>.git is valid.
But, despite this message, clicking the "Synchronize Changes" button causes successful synchronization of the repo, pulling from and pushing to the remote. All this without doing anything explicit with signing out of the account in VS Code.
@mouse07410 did the sign-out + sign in again work? The auth scopes that are used for fetching pull request might be different from those needed to synchronize changes (not sure, I don't know which scopes specifically both use), so just because one thing is working doesn't mean we have the appropriate auth token for everything we try to do in the extension. Additionally, the synchronize changes button comes from a different extension, which could require different auth scopes anyway.
did the sign-out + sign in again work?
No, and it's unclear to me how to manage accounts (GitHub proper, and GitHub Enterprise - I have several of those). Also, it's unclear whether your proposed solution would force the user to sign-in again (which in my view would not be acceptable)?
The auth scopes that are used for fetching pull request might be different from those needed to synchronize changes
If anything, scope for pulling and pushing changes is definitely wider than the scope to merely fetch.
Also, I pasted that exact URL into a browser - and it accessed the repo without any difficulty.
I think we need verbose debugging output, because git commands seem to be working fine - the problem appears to be with what this extension is trying to do.
In that case, we'll just wait and see if a member of the community who is passionate about GitHub Enterprise wants to take a look at the issue.
I can only ad that (a) the "Accounts" button seems to show two other accounts, but not this one, and (b) all the "normal" GitHub functionality seems to be working on this repo with VS Code and Terminal. The only component that seems to have a problem with access, is "vscode-pull-request-github", and it does not give enough info to let me know what it was doing, and what problem it hit. The URL it reports as "possibly invalid" works in a browser via direct/straight cut-and-paste.
Frankly, since most of the stuff seems to be working - I'm not crazy about blasting my entire VS Code config merely to check if this would somehow get rid of an annoying message. And it is unclear how to do a "surgical" check - there's no visible/appropriate account I can "sign out" from. :-(
Update
Got rid of that message by uninstalling this extension.
+1 @alexr00, @mouse07410 - sign out-sign in works for me (Signing out from both enterprise and github).
But the weird part is that the url is wrong. So the message is:
Fetching pull requests for remote '<my github remote name>' failed,
please check if the url <a URL of a different non-github remote> is valid.
After signing in (or re-signing in), everything works. But after every reloading of the vscode window, it breaks. Very frustrating... It somehow messes the remote urls. I have two remotes configured in my .git/config - one with a github remote, one with a non-github. Not sure is this can be related.
EDIT: Figured out the issue is that the model for each remote is updated using the clone_url from the metadata sent by github. In my case because we're using a transparent proxy with a different hostname, this causes a mess... I'll try to fix this on my end, but do you think that's a necessary behavior for the extension? Since the github uri is already configured in vscode.
Since the github uri is already configured in vscode.
You mean with github-enterprise.uri?
I don't want to risk breaking the exiting enterprise support, but maybe someone who knows more knows if it's safe to use that uri or how to modify the path of that uri instead of using the clone_url for enterprise.
@mouse07410 I've finally been able to test with GitHub Enterprise. The error you're seeing usually happens when you're signed in to VS Code with a a github.com account but not a GitHub Enterprise account. I have since fixed this issue. I tested with an SSH git remote and found a separate issue, but starting tomorrow the pre-release build of GitHub Pull Requests and Issues (with the latest VS Code Insiders) should work with your setup.