# Google Cloud: Error: Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started

**Code:** `Could not load the default credentials` · **Category:** Google Cloud / Firebase · **Seen on:** Google Cloud

The Google client library found no Application Default Credentials (ADC) on this machine or environment.

## Meaning

Locally you need gcloud auth application-default login (or GOOGLE_APPLICATION_CREDENTIALS pointing to a key file). On Google Cloud the attached service account is used automatically — outside GCP (other hosts, CI) you must provide credentials (workload identity federation preferred).

## Common causes

- Local machine without gcloud ADC login
- GOOGLE_APPLICATION_CREDENTIALS unset or pointing to a missing file
- Running outside GCP without credentials
- Container missing the mounted key/metadata access

## Quick fix

1. gcloud auth application-default login (local)
2. Use workload identity federation in CI
3. On GCP, attach a service account with the needed roles

## Detailed fix by platform

### Shell

1. 

```bash
gcloud auth application-default login
export GOOGLE_APPLICATION_CREDENTIALS=/secrets/sa.json   # only if you must use a key
```


## How to diagnose

1. **Environment** — Local, GCP or other?
2. **Variable** — GOOGLE_APPLICATION_CREDENTIALS
3. **Identity** — gcloud auth list

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/gcp/could-not-load-default-credentials)
