Skip to content

Instantly share code, notes, and snippets.

@etheleon
Created July 10, 2019 16:56
Show Gist options
  • Save etheleon/e43de51aebb775fd9ec498abdb28753c to your computer and use it in GitHub Desktop.
Save etheleon/e43de51aebb775fd9ec498abdb28753c to your computer and use it in GitHub Desktop.
how to mount gcs

Step 1: Install gcsFUSE (linux)

export GCSFUSE_REPO=gcsfuse-`lsb_release -c -s`
echo "deb http://packages.cloud.google.com/apt $GCSFUSE_REPO main" | sudo tee /etc/apt/sources.list.d/gcsfuse.list
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
sudo apt-get install gcsfuse

Step 2: Add this your ~/.zshrc

MOUNTFOLDER=$HOME/gcs
UID=1000
GID=1000
BUCKET=YOUR_BUCKET_NAME

alias mountgcs='sudo GOOGLE_APPLICATION_CREDENTIALS=$HOME/.creds/serviceaccount.json /usr/bin/gcsfuse --implicit-dirs -o allow_other --uid $UID --gid $GID $BUCKET $MOUNTFOLDER'
alias unmountgcs='sudo fusermount -u $MOUNTFOLDER'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment