credctl setup gcp-cred-file
Synopsis
Section titled “Synopsis”credctl setup gcp-cred-file [flags]Description
Section titled “Description”credctl setup gcp-cred-file generates a JSON credential configuration file that GCP client libraries and gcloud can use to authenticate via credctl.
The generated file uses the executable-sourced credentials format. When a GCP client library needs a token, it executes credctl auth --provider gcp --format executable to get a signed JWT, then handles the STS exchange and service account impersonation itself.
This file is a static configuration — it doesn’t contain credentials or expire. GCP client libraries invoke credctl auth on demand whenever they need a fresh token. You only need to regenerate it if you change the credctl binary location or GCP Workload Identity settings.
Set GOOGLE_APPLICATION_CREDENTIALS to the output file path, or pass it to gcloud with --cred-file.
Requires GCP to be configured first (credctl setup gcp).
| Flag | Type | Default | Description |
|---|---|---|---|
--output | string | ~/.credctl/gcp-credentials.json | Output file path for the credential config. |
Examples
Section titled “Examples”Default output path
Section titled “Default output path”credctl setup gcp-cred-fileCredential configuration written to /Users/you/.credctl/gcp-credentials.json
To use with GCP client libraries: export GOOGLE_APPLICATION_CREDENTIALS=/Users/you/.credctl/gcp-credentials.json
To use with gcloud: gcloud auth login --cred-file=/Users/you/.credctl/gcp-credentials.jsonCustom output path
Section titled “Custom output path”credctl setup gcp-cred-file --output ~/my-gcp-creds.jsonUsing with GCP tools
Section titled “Using with GCP tools”# GCP client libraries (Terraform, Go/Python/Node SDKs)export GOOGLE_APPLICATION_CREDENTIALS=~/.credctl/gcp-credentials.json
# gcloud CLIgcloud auth login --cred-file=~/.credctl/gcp-credentials.json
# Verifygcloud storage lsExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
| 0 | Credential config file written successfully |
| 1 | Error (device not initialised, GCP not configured, or other error) |
See also
Section titled “See also”credctl setup gcp— set up GCP Workload Identity Federationcredctl auth— authenticate with--provider gcp- GCP setup guide — full walkthrough
- Configuration reference —
~/.credctl/config.jsonschema