Commit graph

296 commits

Author SHA1 Message Date
Azeem Sajid
33c30d5bd1 Inconsistent format of examples in help text 2025-02-27 16:26:25 +05:00
William Martin
f019cf7cea
Merge pull request #10501 from cli/wm/fix-minor-auth-login-help
Fix minor auth login help typo
2025-02-25 16:47:38 +01:00
William Martin
ac6ad78ff9 Fix minor auth login help typo 2025-02-25 12:27:30 +01:00
Kynan Ware
d68a4daa8c
docs: OAuth doc link moves to newline
Co-authored-by: Andy Feller <andyfeller@github.com>
2025-02-24 14:12:19 -07:00
Kynan Ware
736447cca4 docs: warn about process revoking all tokens 2025-02-23 18:24:28 +00:00
Kynan Ware
e2f382c44d docs: document how to revoke gh OAuth tokens
This documents how to revoke OAuth tokens generated by `gh`. This also
adjusts some language to match the language used by GitHub.com:
"invalidate" is now "revoke".
2025-02-23 18:12:06 +00:00
Tyler McGoffin
e047d4a611
Merge pull request #10429 from iamazeem/8404-standardize-urls
Standardize URLs
2025-02-13 10:49:18 -08:00
Tyler McGoffin
b4a90c15f9 Add missing <> in gh auth login docs 2025-02-13 10:38:21 -08:00
Azeem Sajid
8b7fb231ec Remove trailing whitespace 2025-02-13 11:06:27 +05:00
William Martin
0a3706a404 Remove unncessary printf usage 2025-01-21 18:04:47 +01:00
Mikel Olasagasti Uranga
4396e40a31 Fix: Ensure constant format strings in fmt and printf calls
Go 1.24 introduces stricter checks for format string validation.
This commit fixes instances where non-constant format strings were
used in calls to functions like `fmt.Errorf`, `fmt.Printf`, and similar.

Signed-off-by: Mikel Olasagasti Uranga <mikel@olasagasti.info>
2025-01-20 16:27:27 +01:00
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