Skip to content

Instantly share code, notes, and snippets.

@todd-dsm
Last active May 17, 2023 15:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save todd-dsm/5e8415d077f06baf4e484ee5800068f9 to your computer and use it in GitHub Desktop.
Save todd-dsm/5e8415d077f06baf4e484ee5800068f9 to your computer and use it in GitHub Desktop.
Install Google Cloud SDK
# Homebrew
brew install --cask google-cloud-sdk
@todd-dsm
Copy link
Author

For Oh My ZSH

Create a custom file like ~/.oh-my-zsh/custom/environment.zsh and add:

export USE_GKE_GCLOUD_AUTH_PLUGIN=True
source "/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.zsh.inc"
source "/opt/homebrew/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.zsh.inc"

Write/quit and pull completions into the enviornment:

% exec zsh


For GNU Bash

Edit ~/.bashrc and add:

###############################################################################
###                        Google Cloud Platform                            ###
###############################################################################
#export GOOGLE_APPLICATION_CREDENTIALS="$HOME/Downloads/tfadmin-$USER.json"
gcloudCompsDir='/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk'   
if [[ -d "$gcloudCompsDir" ]]; then                                                
    while read -r compFile; do                                                     
        #printf '%s\n' "  ${compFile##*/}"                                         
        source "$compFile"                                                         
    done <<< "$(find "$gcloudCompsDir" -maxdepth 1 -type f -name '*bash.inc')"  
fi                                                                                 

Source-in those changes
source ~/.bashrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment