Edit on GitHub

Google Cloud Storage

Start with dvc remote add to define the remote. Set a name and a valid Google Cloud Storage URL:

$ dvc remote add -d myremote gs://<mybucket>/<path>

Upon dvc push (or when needed), DVC will try to authenticate using your gcloud CLI authorization. This reads the default GCP key file.

Make sure to run gcloud auth application-default login unless you use a service account or other ways to authenticate (more info).

To use custom auth or further configure your DVC remote, set any supported config param with dvc remote modify.

Custom authentication

For service accounts (a Google account associated to your GCP project instead of a user), you can set the path to the file that contains a service account key:

$ dvc remote modify --local myremote \
                    credentialpath 'path/to/project-XXX.json'

The dvc remote modify --local flag is needed to write sensitive user info to a Git-ignored config file (.dvc/config.local) so that no secrets are leaked through Git. See dvc config.

Alternatively, the GOOGLE_APPLICATION_CREDENTIALS environment variable can be set:

$ export GOOGLE_APPLICATION_CREDENTIALS='.../project-XXX.json'

More configuration parameters

See dvc remote modify for more command usage details.

  • url - modify the remote location (scroll up for details)

  • projectname - override or provide a project name to use if a default one is not set.

Content

🐛 Found an issue? Let us know! Or fix it:

Edit on GitHub

Have a question? Join our chat, we will help you:

Discord Chat