You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support VSCode builtin GitHub authentication #1074
If gh had support for that too, we could have a seamless GitHub Authentication when using gh inside VSCode, which can mainly benefit vscode-dev-containers, Visual Studio Codespaces, and therefore, the upcoming GitHub Codespaces.
Hi thank you for letting us know! You bring up a good point that this would make it easier to get going with gh inside 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 repo scopes. CLI needs a few more scopes than that, namely read:org at 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!
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
If the scope of authentication provided to git isn't enough, then certainly the GitHub extension can contribute with it, since it has the required scopes.
I just had another idea: gh could support an environment variable called GH_HOSTS which 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 expose GITHUB_TOKEN in an integrated terminal to make this happen.
gh could support an environment variable called GH_HOSTS which is taken as a preference over ~/.config/hosts.yaml
That's not a bad idea in general, but there is still the problem I outlined above: we would generally prefer if gh used 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.
Activity
chore(devcontainer): add nest, commitizen and heroku
chore(devcontainer): add nest, commitizen and heroku
mislav commentedon 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
Lewiscowles1986 commentedon Jun 2, 2020
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 themfelipecrs commentedon Jun 2, 2020
@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.felipecrs commentedon Jun 2, 2020
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.felipecrs commentedon Jun 24, 2020
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.mislav commentedon Jun 25, 2020
That'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.ljtill commentedon Jul 3, 2020
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.