Skip to content

credctl setup gcp-cred-file

Terminal window
credctl setup gcp-cred-file [flags]

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).

FlagTypeDefaultDescription
--outputstring~/.credctl/gcp-credentials.jsonOutput file path for the credential config.
Terminal window
credctl setup gcp-cred-file
Credential 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.json
Terminal window
credctl setup gcp-cred-file --output ~/my-gcp-creds.json
Terminal window
# GCP client libraries (Terraform, Go/Python/Node SDKs)
export GOOGLE_APPLICATION_CREDENTIALS=~/.credctl/gcp-credentials.json
# gcloud CLI
gcloud auth login --cred-file=~/.credctl/gcp-credentials.json
# Verify
gcloud storage ls
CodeMeaning
0Credential config file written successfully
1Error (device not initialised, GCP not configured, or other error)