Authentication (gh auth)#
pw_ghish: GitHub CLI-like interface for Gerrit code reviews and CI checks
./gh auth checks authentication status across the three backends used by
pw_ghish:
Gerrit Code Review (e.g.,
pigweed-review.googlesource.com)LUCI Buildbucket & LogDog (
cr-buildbucket.appspot.com,logs.chromium.org)Google Issue Tracker / Buganizer (
issuetracker.corp.googleapis.com)
Command reference#
Command |
Description |
|---|---|
|
Check authentication status across Gerrit, LUCI Buildbucket, and
Buganizer. Exits |
|
Output JSON authentication status (fields: |
Checking authentication status#
Run ./gh auth status to verify your credentials:
$ ./gh auth status
Authentication Mode: googler (auto-detected (gosso on PATH))
pigweed-review.googlesource.com (Gerrit)
✓ Logged in to pigweed-review.googlesource.com as Keir Mierle <keir@google.com> (account #1000020)
- Method: corp-sso
cr-buildbucket.appspot.com (LUCI Buildbucket & LogDog)
✓ Authenticated with cr-buildbucket.appspot.com via luci-auth (internal & public builders visible)
- Method: luci-auth
issuetracker.corp.googleapis.com (Google Issue Tracker)
✓ Authenticated with issuetracker.corp.googleapis.com via gosso + luci-auth
- Method: gosso + luci-auth
Verdict: authenticated (googler mode; all required services healthy)
Next: gh pr status
Pass --json to output specific fields for scripts or tools:
$ ./gh auth status --json mode,authenticated,gerrit,luci
Authentication modes#
pw_ghish supports four authentication modes via --auth-mode or
GH_ISH_AUTH_MODE:
Mode |
Behavior |
|---|---|
|
(Default) Selects |
|
Requires authenticated access to both Gerrit and LUCI Buildbucket so
internal tryjob buckets (such as |
|
Authenticates Gerrit via |
|
Uses unauthenticated HTTP requests for all services. |
Configuration precedence#
The active authentication mode is resolved in the following order:
CLI flag:
--auth-mode <auto|googler|community|none>Environment variable:
GH_ISH_AUTH_MODE=<auto|googler|community|none>Git configuration:
git config ghish.authmode <auto|googler|community|none>Default:
auto
Credential resolution#
One login for every service#
pw_ghish accesses several separate backends—Gerrit, LUCI Buildbucket,
Android Build, and Google Issue Tracker—and uses Corp SSO for Google-hosted
Gerrit in googler mode plus a single luci-auth login across OAuth2
backends based on your authentication mode:
googler: Covers Gerrit, LUCI, Android Build, and Google Issue Tracker, so working across Pigweed and Android requires only one login.community: Covers Gerrit and LUCI.none: Disables authentication.
To log in:
Corp Linux workstations & Cloudtops: Run
gcert. No separateluci-auth loginstep is needed.Elsewhere (including Corp Linux laptops with
GOOGLE_ROLE=laptopand macOS): Run./gh auth statusand follow its instructions.
If you are a Googler on a machine detected as community (for example,
without Corp tools on PATH and with a non-@google.com user.email),
set GH_ISH_AUTH_MODE=googler or
git config --global ghish.authmode googler before logging in.
Gerrit Code Review & Git Push#
pw_ghish resolves Gerrit REST credentials in the following order:
GERRIT_TOKENenvironment variable (OAuth2 Bearer token). A value containing:(ausername:passwordpair for HTTP Basic auth) is rejected with exit code4; HTTP Basic auth (used by most non-Google Gerrit servers) isn’t supported yet.Corp SSO on Google-hosted Gerrit (
*.googlesource.com) ingooglermode (rungcertto authenticate; see Why Corp SSO is preferred). Open Gerrit hosts fall back toluci-auth(step 3) with a warning when Corp SSO is unavailable or unauthorized on reads (setGHISH_CORP_SSO=0to prefer OAuth2 on open hosts); corp-only Gerrit hosts require Corp SSO.Shared
luci-authcredentials on Google-hosted Gerrit (*.googlesource.com; see One login for every service). For other Gerrit hosts, setGERRIT_TOKEN.Anonymous HTTPS (permitted in
communityandnonemodes for public reads; rejected ingooglermode with exit code4).
Why Corp SSO is preferred#
Gerrit’s review enforcement (Review-Enforcement submit requirement) checks
per vote whether the voter used a BeyondCorp-trusted device. Requests sent via
Corp SSO carry device trust, whereas OAuth2 requests on *.googlesource.com
do not—so a Code-Review+2 cast over OAuth2 is recorded as
missing device trust and does not count on hosts that enforce it (such as
pigweed-review.googlesource.com). ./gh auth status reports
Method: corp-sso when Corp SSO is active and prints a warning when it is
not. In googler mode, ./gh pr review refuses positive Code-Review
votes over OAuth2 on changes with an applicable Review-Enforcement submit
requirement, exiting with code 4 instead of casting a vote Gerrit would
ignore (see Code review (gh pr)).
Note
GH_ISH_AUTH_METHOD has been removed. If it is set, commands (except
./gh hook) exit with code 4 and print replacement credential steps.
To disable authentication, use --auth-mode=none or
GH_ISH_AUTH_MODE=none.
Community contributor onboarding#
To authenticate for creating, pushing, and reviewing changes outside Google Corp:
Provision your Gerrit account: Sign in once at
https://<host>-review.googlesource.com(for example,https://pigweed-review.googlesource.com) in a web browser. Gerrit provisions a new user account on first web sign-in; REST andgit pushrequests before first web login returnHTTP 400.Sign the Google CLA: Sign the Contributor License Agreement at
https://cla.developers.google.com/and ensuregit config user.emailmatches.Log in with luci-auth: Run
luci-auth(bundled inenvironment/cipd/packages/luci/luci-authviasource bootstrap.sh/activate.sh, or indepot_tools) and verify with./gh auth status:$ luci-auth login -scopes "https://www.googleapis.com/auth/gerritcodereview https://www.googleapis.com/auth/userinfo.email" $ ./gh auth status
Push over HTTPS without cookies:
./gh pr createand./gh pr pushfirst push with your own git credentials. If a push tohttps://<tenant>.googlesource.com/is rejected for authentication, they retry once with theluci-auth(orGERRIT_TOKEN) token in anAuthorization: Bearerheader, so~/.gitcookiesis not required. No token is sent when--auth-mode=none.
Automatic Git transport fallbacks (push & fetch)#
On Google Corp workstations, gcert --lifetime=168h issues a 7-day
LOAS2 certificate (used by rpc:// and sso-cred-helper), whereas the
SSO login cookie / ticket used by sso:// is capped at ~20 hours. When a
git push or git fetch against a Gerrit remote fails transport
authentication in googler mode, pw_ghish retries using per-invocation
Git config overrides (leaving ~/.gitconfig and .git/config untouched):
Corp Linux (Cloudtop / gLinux): Tries
rpc://, thensso://, and finallyhttps://with OAuth2.Corp macOS &
GOOGLE_ROLE=laptop: Triessso://and thenhttps://with OAuth2.
On corp-only Gerrit hosts that enforce IP/SSO restrictions, pw_ghish skips
the https:// fallback and prescribes gcert.
LUCI Buildbucket & LogDog#
LUCI Buildbucket and LogDog requests look up credentials in the following order:
GHISH_LUCI_TOKENorLUCI_TOKENenvironment variable.Shared
luci-authcredentials (see One login for every service).
In googler mode, LUCI authentication is required so queries include both
public and internal CQ builders. Run gcert on Corp Linux, or
./gh auth status elsewhere to see the login command when needed.
Google Issue Tracker (Buganizer)#
./gh issue looks up credentials in the following order:
GHISH_ISSUE_TOKENorBUGANIZER_TOKENenvironment variable.Shared
luci-authcredentials ingooglermode (see One login for every service). Incommunitymode, setGHISH_ISSUE_TOKENorBUGANIZER_TOKEN.
./gh issue requires Google Corp credentials; community contributors can
view and file issues on the web at https://issues.pigweed.dev.
Comparison with GitHub CLI (gh auth)#
Feature / Flag |
Upstream |
|
|---|---|---|
|
Checks authentication against a single GitHub host ( |
Checks credentials across three distinct backends: Gerrit, LUCI Buildbucket, and Google Issue Tracker (Buganizer). |
|
Outputs |
Outputs |
|
(n/a) ( |
Global ghish-only flag ( |
|
Interactive OAuth flow managed directly by |
Delegated to native credential tools ( |
For the flag compatibility policy across all subcommands, see Compat policy.