Commit graph

285 commits

Author SHA1 Message Date
William Martin
e7d49fb78c
Update pkg/cmd/auth/login/login.go
Co-authored-by: Andy Feller <andyfeller@github.com>
2025-01-06 17:21:02 +01:00
William Martin
3695bda637 Clear up --with-token fine grained PAT usage 2025-01-06 16:41:48 +01:00
Tyler McGoffin
aa793f1dac
Update pkg/cmd/auth/login/login.go
Co-authored-by: Kynan Ware <47394200+BagToad@users.noreply.github.com>
2025-01-02 14:22:20 -08:00
Tyler McGoffin
ae9e68b803 Move mention of classic token to correct line 2025-01-02 10:41:25 -08:00
Tyler McGoffin
375dbf19da Add mention of classic token in gh auth login docs 2025-01-02 10:08:28 -08:00
Andy Feller
4f32282f93 Update gh auth commands to point to GitHub Docs
After initial discussion with core maintainers, it didn't seem prudent to duplicate the GitHub Docs information on OAuth scopes within the GitHub CLI codebase.

Instead, this commit updates help usage information in relevant commands on the page within GitHub Docs for more information.
2024-12-12 11:03:57 -05:00
ANKDDEV
24db9f64c7
docs: add mention of scopes help topic in auth refresh command help 2024-12-06 17:06:19 +03:00
ANKDDEV
53ee6ae56f
docs: add mention of scopes help topic in auth login command help 2024-12-06 17:04:59 +03:00
Caleb Brose
940560acf2
Fix ssh directory 2024-11-06 16:13:29 +00:00
Tyler McGoffin
81591a09b8 Use go-gh/auth package for IsEnterprise, IsTenancy, and NormalizeHostname 2024-10-15 11:56:43 -07:00
Tyler McGoffin
f4af65d9df Update docs language to remove possible confusion around 'where you log in' 2024-09-23 09:35:57 -07:00
Tyler McGoffin
029dc8ffc1 Change conditional in promptForHostname to better reflect prompter changes
The old isEnterprise check no longer makes sense, given the prompter is
providing 'other', not 'GitHub Enterprise Server' as its non-GitHub.com
option. Additionally, there was an opportunity for cleaning up the code
via early returns and the removal of the default hostname lookup if we
don't need it.
2024-09-23 09:04:03 -07:00
Tyler McGoffin
ccb830ca36 Shorten language on Authenticate with a GitHub host.
The default authentication mode is a web-based browser flow. After completion, an
authentication token will be stored securely in the system credential store.
If a credential store is not found or there is an issue using it gh will fallback
to writing the token to a plain text file. See `gh auth status` for its
stored location.

Alternatively, use `--with-token` to pass in a token on standard input.
The minimum required scopes for the token are: `repo`, `read:org`, and `gist`.

Alternatively, gh will use the authentication token found in environment variables.
This method is most suitable for "headless" use of gh such as in automation. See
`gh help environment` for more info.

To use gh in GitHub Actions, add `GH_TOKEN: ${{ github.token }}` to `env`.

The git protocol to use for git operations on this host can be set with `--git-protocol`,
or during the interactive prompting. Although login is for a single account on a host, setting
the git protocol will take effect for all users on the host.

Specifying `ssh` for the git protocol will detect existing SSH keys to upload,
prompting to create and upload a new key if one is not found. This can be skipped with
`--skip-ssh-key` flag.

USAGE
  gh auth login [flags]

FLAGS
  -p, --git-protocol string   The protocol to use for git operations on this host: {ssh|https}
  -h, --hostname string       The hostname of the GitHub instance to authenticate with
      --insecure-storage      Save authentication credentials in plain text instead of credential store
  -s, --scopes strings        Additional authentication scopes to request
      --skip-ssh-key          Skip generate/upload SSH key prompt
  -w, --web                   Open a browser to authenticate
      --with-token            Read token from standard input

INHERITED FLAGS
  --help   Show help for command

EXAMPLES
  # Start interactive setup
  $ gh auth login

  # Authenticate against github.com by reading the token from a file
  $ gh auth login --with-token < mytoken.txt

  # Authenticate with specific host
  $ gh auth login --hostname enterprise.internal

LEARN MORE
  Use `gh <command> <subcommand> --help` for more information about a command.
  Read the manual at https://cli.github.com/manual
  Learn about exit codes using `gh help exit-codes` around Tylers-GitHub-MacBook.local
2024-09-20 15:51:07 -07:00
Tyler McGoffin
2059c630a2 Update language on docstring for gh auth login 2024-09-20 14:12:13 -07:00
Tyler McGoffin
13e916bcfb Change prompts for gh auth login to reflect change from GHE to Other 2024-09-20 14:10:05 -07:00
Tyler McGoffin
bc587f6576 Sentence case 'Other' option in hostname prompt 2024-09-20 13:55:20 -07:00
Tyler McGoffin
46790977bb Add documentation explaining how to use hostname for gh auth login 2024-09-19 15:25:23 -07:00
Tyler McGoffin
5dd5246307 Replace "GitHub Enterprise Server" with "other" in gh auth login prompt
This change is meant to better support the login flow for other customers
besides GitHub Enterprise Server customers that use the same login flow
as GHES.
2024-09-19 15:25:23 -07:00
Andy Feller
24336f1344 Enhance gh repo create docs, fix random cmd link
Relates #8946

- updates the documentation within `gh repo create` to include links to lookup .gitignore templates and licenses
- fixes link markup within `gh auth setup-git` so link is formatted correctly on https://cli.github.com
2024-09-16 13:42:51 -04:00
Andy Feller
03c34e71f9 Expand active test cases 2024-08-30 10:57:51 -04:00
Velmurugan
1eecfd4530 Added --active flag to the gh auth status command 2024-08-24 16:24:51 +05:30
Stausssi
e7606363fb
document exit code behavior 2024-07-22 20:36:22 +02:00
Simon
0a3a12839d
Exit with 1 on authentication failure 2024-07-22 20:22:42 +02:00
William Martin
a37253746e Remove TODO and add comment on LoginFlow tests 2024-05-17 14:51:02 +02:00
William Martin
3fe555b0bb Comment the purpose of the helper config contract 2024-05-17 14:33:19 +02:00
William Martin
540bda1a6b Test git credentials are configured in LoginFlow 2024-05-17 14:31:21 +02:00
William Martin
ba1afa2c5d Add HelperConfig contract test and FakeHelperConfig 2024-05-17 14:16:14 +02:00
William Martin
3ea937d903 Inject GitCredentialFlow to LoginFlow as test seam 2024-05-17 13:26:23 +02:00
William Martin
3803fd04b9 Add Helper test for Windows 2024-05-16 17:01:41 +02:00
William Martin
64d50e6fbc Add tests for gitcredentials Updater 2024-05-16 15:37:18 +02:00
William Martin
37abb3ec96 Fix mistaken git installation error check 2024-05-16 14:38:51 +02:00
William Martin
e07a26d81c Move gitcredentials HelperConfig and add tests 2024-05-16 14:34:28 +02:00
William Martin
d75548a630 Comment the new gitcredentials package 2024-05-16 13:48:53 +02:00
William Martin
187c5016f0 Comment the git credential flow 2024-05-16 13:39:42 +02:00
William Martin
818d4ba5b8 Remove unnecessary credential setup private method 2024-05-16 13:39:42 +02:00
William Martin
c16836bcf7 Use tighter interface in setup-git 2024-05-16 13:39:42 +02:00
William Martin
177cf7d35b Rename gitcredentials Configure to ConfigureOurs 2024-05-16 13:15:26 +02:00
William Martin
bd4ba5c39a Make gitcredential helper smarter 2024-05-16 13:15:26 +02:00
William Martin
af589aa2f3 Move fetching configured helper into gitcredentials 2024-05-16 12:39:11 +02:00
William Martin
a3d65e0dce Extract units for configuring and updating git credential helpers 2024-05-16 12:32:55 +02:00
William Martin
07e0ff7127 Fix repo fork to use remote protocol if none configured 2024-05-10 10:48:36 +02:00
William Martin
1d38230675
Move config interfaces into gh package (#9060) 2024-05-10 10:39:36 +02:00
William Martin
5007c18f5f Fix unused params across project 2024-05-07 17:50:43 +02:00
William Martin
4ca098b0c9 Adjust short and long to be the same 2024-05-01 14:17:08 +02:00
William Martin
5a5b04d132 Document relationship between host and active account 2024-05-01 11:14:00 +02:00
Nero Blackstone​
93113e12ea
Add colon at the end of secret prompts (#9004) 2024-04-26 12:58:45 +02:00
Babak K. Shandiz
1992fdeb1a
Use filepath.Join to support different platforms
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-14 00:09:53 +01:00
Babak K. Shandiz
a269032fd3
Refactor into table tests
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-13 21:13:12 +01:00
Babak K. Shandiz
2c6343ad56
Explain --skip-ssh-key usage in long doc
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-13 15:47:44 +01:00
Babak K. Shandiz
8839ee7ddf
Test --skip-ssh-key is captured correctly
Signed-off-by: Babak K. Shandiz <babak.k.shandiz@gmail.com>
2024-04-06 13:11:02 +01:00