Commit graph

75 commits

Author SHA1 Message Date
Mislav Marohnić
c5af4ddfdc
Merge pull request #3009 from cli/git-credential-env
Fix `auth git-credential` when the token comes from environment
2021-02-23 16:32:23 +01:00
Mislav Marohnić
cfddda8829 Indicate workflow scope is GHE 3.0+ only during auth login 2021-02-23 10:52:29 +01:00
Mislav Marohnić
f807795491 Fix pasting Personal Access Token to auth login for GHE 2021-02-23 10:19:11 +01:00
Mislav Marohnić
9bf1668b3f Fix auth git-credential when the token comes from environment
When a token such as GH_TOKEN is set through environment variables and
`~/.config/gh/hosts.yml` is non-existent, the `auth git-credential get`
command used to fail due to missing username.

Since GitHub username isn't at all required for token authentication,
use the `x-access-token` faux username instead of trying to obtain one
from a config file.
2021-02-19 15:37:11 +01:00
Mislav Marohnić
1a9e42ed55 Add ssh-key add command and publish ssh-key 2021-02-17 19:46:59 +01:00
Mislav Marohnić
4a49e3526c Merge remote-tracking branch 'origin' into writeorg-oauth-scope 2021-02-17 17:11:24 +01:00
Mislav Marohnić
b4bf8cda8d Close pubkey file after reading 2021-02-17 17:01:14 +01:00
Mislav Marohnić
87fcda5fbc Add tests for SSH login flow 2021-02-17 16:52:40 +01:00
Mislav Marohnić
9550ad0159
Tweak prompt for SSH passphrase
Co-authored-by: Amanda Pinsker <ampinsk@github.com>
2021-02-05 10:16:42 +01:00
Mislav Marohnić
1bd6d7b36c Extract parts of HTTPS-related setup shared between login and refresh 2021-02-04 18:36:42 +01:00
Mislav Marohnić
5a110c8e42 Add SSH key generation & uploading to gh auth login flow 2021-02-01 23:34:00 +01:00
Sam Coe
71fd2fa24c
Fix up test 2021-01-22 08:50:09 -08:00
Sam Coe
5e10638b0e
Merge branch 'trunk' into auth-status-fail 2021-01-22 08:46:24 -08:00
Nate Smith
5430728a0a
Merge pull request #2813 from cli/token-from-env-err
More descriptive error when aborting auth due to environment variables
2021-01-20 15:06:52 -08:00
Mislav Marohnić
4a2cc8d2a4 Simplify ssh-key list
Do not require nor request `read:public_key` scope by default.
2021-01-20 20:23:57 +01:00
edualb
e26a1b98a1 add ssh-key command 2021-01-20 20:23:38 +01:00
Mislav Marohnić
c9407b2629 More descriptive error when aborting auth due to environment variables
Old message:

    read-only token in GH_TOKEN cannot be modified

This message was vague and some users did not understand that this
refers to the value that is read from environment variables.

New message:

    $ GH_TOKEN=123 ghd auth login -h github.com
    The value of the GH_TOKEN environment variable is being used for authentication.
    To have GitHub CLI store credentials instead, first clear the value from the environment.
2021-01-20 18:27:35 +01:00
Mislav Marohnić
75ebb863e3 Use testify assertions for error matching 2021-01-19 13:59:37 +01:00
Nilesh Singh
f3fcaf6c9c Fix error message text & add test case 2021-01-17 14:42:49 +05:30
Nilesh Singh
2f5ffbd60a Add fail message for non-existent hostname 2021-01-15 13:28:57 +05:30
Mislav Marohnić
38ea595ce2 Fix refresh test 2020-12-07 20:07:20 +01:00
Mislav Marohnić
3c76eb15a4 Add tests for auth git-credential command 2020-12-07 20:01:53 +01:00
Mislav Marohnić
381e83e6e5 Extend git credential prompt to auth refresh 2020-12-07 20:01:16 +01:00
Mislav Marohnić
c39dc28fa1 Rename auth/client to auth/shared 2020-12-07 17:08:42 +01:00
Mislav Marohnić
d56d92c908 If git credential helper is non-defined, set gh as credential helper 2020-11-23 20:20:05 +01:00
Mislav Marohnić
e36c9029d3 Fix broken tests 2020-11-20 20:33:08 +01:00
Mislav Marohnić
91d2adc134 Avoid re-requesting username if we already have it 2020-11-20 19:36:26 +01:00
Mislav Marohnić
67672fa88c Prime user's git HTTPS credentials on auth login 2020-11-20 19:36:04 +01:00
vilmibm
a2aa154794 port entirely to ColorScheme 2020-10-29 12:37:45 -07:00
Sam
edecb2e4f7
Merge pull request #2207 from cli/codespaces
[Codespaces] Support "integration" tokens
2020-10-27 15:37:02 +03:00
Mislav Marohnić
460d55f723 Move HostnameValidator to ghinstance 2020-10-21 16:31:20 +00:00
wilso199
3ecb9de1a7 Adding a hostname flag option for use with gh api 2020-10-21 16:31:20 +00:00
Sam
f8fd61cc6c
Merge pull request #2157 from rista404/print-auth-token-1514
Add ability to print auth token
2020-10-20 08:46:45 +02:00
Mislav Marohnić
4bda6fceec auth status: fix reporting the token source 2020-10-16 17:11:14 +00:00
Ryan Nystrom
02883a89e3 add tests 2020-10-16 15:59:41 +00:00
Ryan Nystrom
93bc389269 Add scopes flag to login 2020-10-15 22:04:18 +00:00
rista404
2bdfc10e0a
Add ability to print auth token 2020-10-11 12:55:34 +02:00
Mislav Marohnić
49909b5123 Tweak gh auth login examples 2020-10-01 19:56:56 +02:00
Mislav Marohnić
cc2b86f3a6 Specify minimum required token scopes in gh help auth login 2020-10-01 19:56:33 +02:00
Martín Montes
cacf0157b3 Using ghinstance.OverridableDefault() instead of a harcoded hostname 2020-09-22 18:22:29 +02:00
Martín Montes
793e866850 Using assert.Regexp for testing stderr's content 2020-09-22 17:50:57 +02:00
Martín Montes
81caade918 Access token tip message using hostname 2020-09-22 12:32:37 +02:00
vilmibm
68a019cc3c review feedback 2020-09-14 10:16:50 -05:00
vilmibm
2345f49ccb support auth login --web 2020-09-11 13:07:39 -05:00
vilmibm
3a492b892a Merge branch 'disable-prompts' of github.com:cli/cli into disable-prompts 2020-09-11 11:42:20 -05:00
vilmibm
1073c97409 review feedback 2020-09-11 11:36:24 -05:00
vilmibm
4d3e26e927 prompts disabled test for auth refresh
the behavior for nontty vs. prompts disabled is pretty different so i
opted for a new test, here
2020-09-10 13:19:43 -05:00
vilmibm
c0fc31f7d5 use CanPrompt in commands 2020-09-10 12:13:48 -05:00
vilmibm
15bfb5447b split auth flow code into new internal package 2020-09-10 12:13:48 -05:00
Mislav Marohnić
c80292c2e8 Extend Config object with GITHUB_TOKEN support
Adding GITHUB_TOKEN & GITHUB_ENTERPRISE_TOKEN support orthogonal to
Config was getting out of hand, especially in `auth` commands that
adjust their messaging and error status based on the presence of these
environment variables.

The new approach builds in support for tokens from environment straight
into Config object by composition. Thus, commands need not ever be
concerned with any specific environment variables.
2020-09-07 21:33:26 +02:00