Preview
Open Original
๐ Step 1 โ Install Google Cloud SDK
Windows
Download installer:
https://cloud.google.com/sdk/docs/install
macOS
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
Linux
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-367.0.0-linux-x86_64.tar.gz
tar -xf google-cloud-sdk-367.0.0-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
exec -l $SHELL
โ๏ธ Step 2 โ Initialize Cloud SDK
gcloud init
๐ GCP Login Methods
โ Method 1 โ Login Using Browser
gcloud auth login
โ Method 2 โ Login Without Browser (SSH Server)
gcloud auth login --no-launch-browser
You will get a URL โ open it โ paste code.
โ Mโฆ
๐ Step 1 โ Install Google Cloud SDK
Windows
Download installer:
https://cloud.google.com/sdk/docs/install
macOS
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
Linux
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-367.0.0-linux-x86_64.tar.gz
tar -xf google-cloud-sdk-367.0.0-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
exec -l $SHELL
โ๏ธ Step 2 โ Initialize Cloud SDK
gcloud init
๐ GCP Login Methods
โ Method 1 โ Login Using Browser
gcloud auth login
โ Method 2 โ Login Without Browser (SSH Server)
gcloud auth login --no-launch-browser
You will get a URL โ open it โ paste code.
โ Method 3 โ Set Default Project
gcloud config set project PROJECT_ID
โ Method 4 โ Verify Login
gcloud config list
๐ฏ Method 5 โ Application Default Credentials (ADC)
Used by SDKs / Terraform / APIs
gcloud auth application-default login
๐ Method 6 โ Service Account Login (Automation / CI-CD)
gcloud auth activate-service-account --key-file=key.json
gcloud config set project PROJECT_ID
๐ Method 7 โ Workload Identity Federation (Keyless Login)
gcloud auth login --cred-file=workload-identity-credential.json
๐ง Method 8 โ Cloud Shell Login (No Install)
Go to:
https://console.cloud.google.com
Click Activate Cloud Shell โ
๐งฉ Method 9 โ Terraform + GCP Authentication
gcloud auth application-default login
๐ Method 10 โ Docker / Artifact Registry Login
gcloud auth configure-docker
๐ป Method 11 โ Login to GCP Git Repos
gcloud source repos clone REPO_NAME --project=PROJECT_ID
๐ Useful Commands
| Action | Command |
|---|---|
| List projects | gcloud projects list |
| Show active auth | gcloud auth list |
| Remove login | gcloud auth revoke |
| Update SDK | gcloud components update |