Repository navigation
Support VSCode builtin GitHub authentication #1074
Description
Activity
- added 2 commits that reference this issue
on Jun 2, 2020 Hi thank you for letting us know! You bring up a good point that this would make it easier to get going with
ghinside Codespaces. ✨Unfortunately, I don't think we can piggy-back on VSCode authentication for our needs. First of all, that authentication is probably done via an OAuth app of their own, and we need to connect to our "GitHub CLI" OAuth app for the purposes of ocassionally getting access to some preview APIs. Second of all, we don't know which OAuth scopes does the VSCode authentication request, but since it's only git, it's probably only requests the
reposcopes. CLI needs a few more scopes than that, namelyread:orgat least.This is mostly just me guessing, though, and if anybody would be willing to dive into VSCode source and look up how they set up this authentication and link it here, I would be grateful!
Ref. #297
I'll be honest that workflow in VSCode broke my private key workflow, which in itself was a workaround to their git tooling being only useful for choosing which files to
git add. I'm furious with them@mislav The PR relevant on VS Code: microsoft/vscode#96069
It seems that GitHub Authentication is provided by VS Code to
gitCLI through GIT_ASKPASS.Reacted by Mislav MarohnićIf the scope of authentication provided to
gitisn't enough, then certainly the GitHub extension can contribute with it, since it has the required scopes.I just had another idea:
ghcould support an environment variable calledGH_HOSTSwhich is taken as a preference over~/.config/hosts.yaml. VS Code could them create this file, fill the information (username and token) and contribute to the environment of the integrated terminal with this variable. This way, we at least don't have to fully exposeGITHUB_TOKENin an integrated terminal to make this happen.ghcould support an environment variable calledGH_HOSTSwhich is taken as a preference over~/.config/hosts.yamlThat's not a bad idea in general, but there is still the problem I outlined above: we would generally prefer if
ghused a token that's tied to its own OAuth app, rather than one generated by another OAuth app. That's why I said that piggybacking on another tool's authentication mechanism could lead to limited functionality.Not the solution but in case it's useful for anyone; I've found adding a Personal Access Token in the Environment Variables (GITHUB_TOKEN) settings within VS Codespaces has solved this challenge in the short term.
Reacted by Mislav Marohnić and Ari Crellin-Quick- addedcoreThis issue is not accepting PRs from outside contributorsThis issue is not accepting PRs from outside contributorsneeds-investigationCLI team needs to investigateCLI team needs to investigate
on Oct 7, 2020
VSCode now provides GitHub authentication for
giteven in its Terminal.If
ghhad support for that too, we could have a seamless GitHub Authentication when usingghinside VSCode, which can mainly benefitvscode-dev-containers, Visual Studio Codespaces, and therefore, the upcoming GitHub Codespaces.