-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
VSCode.dev can't switch branches in private repositories #138517
Comments
I can reproduce with repos that require SAML. I.e. some of the private Microsoft ones, but not with my personal private repos. @seanofw Do your private repos happen to be org repos that require single sign on? |
My private repos are personal, private repos on GitHub. I do have 2FA enabled for my account, though, so it's quite possible that it's still doing corporate-like SSO-ish things with them. |
@seanofw do you have slashes in the names of the branches that you're trying to switch to? And if you install the GitHub Repositories extension on desktop VS Code, can you switch branches in the same repo? |
OK, it looks like this is a bug in how the workbench embedder parses branch names for private repos. Public repos are unaffected because no authentication is required to validate the branch name against the GitHub APIs. |
The problem is that for treeish GitHub urls, we can't tell where the branch name (which can contain slashes) ends and the directory path begins. For example,
So in the dev branch case above, our current code assumes that This bug impacts vscode.dev only and not github.dev or desktop RemoteHub, because you have to sign into GitHub to access github.dev, and RemoteHub asks you to sign into GitHub when accessing a GitHub repo as well. To handle opening treeish urls in private repos correctly, some component in the vscode.dev -> RemoteHub flow must be able to make an authenticated GH extract-ref API call (which is how github.dev deals with this problem) to validate the url.
|
@joyceerhl Indeed I do use slash-delimited branch names, and I'll bet that's the exact cause. I use branch names like Admittedly, while invoking the extract-ref API is probably the right answer, you might want to consider implementing a cheat in the short term and allow for a user-specified wildcard pattern or a regex to be specified in the configuration somewhere that indicates either what part of the path is the branch name ( |
Correct, this won't work unless we come up with a way for a lightweight extension host to spin up both the GitHub Authentication and RemoteHub extensions, let them auth and resolve the workspace and only then open it up. This is somewhat what already happens in remote. I've had discussions about it with @bpasero. Also cc @alexdima @aeschli. |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
master
(or whatever the default branch is named).master
.This appears to only happen in my private repositories; it doesn't seem to happen in any of the public ones. It can correctly load
master
from the private repositories, just not other branches.I'm using Firefox 93, 64-bit, on Windows 10 64-bit.
I just heard about VSCode.dev tonight and thought I'd give it a spin, so I opened it, pointed it at the repository I've been working in lately, switched to the branch I've been working in, and — immediately it broke :(
The text was updated successfully, but these errors were encountered: