Skip to content

Commit

Permalink
gdrive: add gdrive_user_credentials_file description (#1192)
Browse files Browse the repository at this point in the history
* gdrive: add gdrive_user_credentials_file description

* gdrive remote modify: simplify a bit gdrive_user_credentials_file description

* gdrive remote: apply suggestions from code review

Co-Authored-By: Jorge Orpinel <[email protected]>

* Update content/docs/user-guide/setup-google-drive-remote.md

* gdrive: update text after testing the gdrive_user_credentials_file option

Co-authored-by: Jorge Orpinel <[email protected]>
  • Loading branch information
shcheklein and jorgeorpinel authored Apr 28, 2020
1 parent aefdd02 commit cba33a3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
11 changes: 11 additions & 0 deletions content/docs/command-reference/remote/modify.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,17 @@ a full guide on using Google Drive as DVC remote storage.
$ dvc remote modify myremote gdrive_client_secret <client secret>
```

- `gdrive_user_credentials_file` - path where DVC stores OAuth credentials to
access Google Drive data. `.dvc/tmp/gdrive-user-credentials.json` by default.

```dvc
$ dvc remote modify myremote gdrive_user_credentials_file \
.dvc/tmp/myremote-credentials.json
```

See [Authorization](/doc/user-guide/setup-google-drive-remote#authorization)
for more details.

- `gdrive_trash_only` - configures `dvc gc` to move remote files to
[trash](https://developers.google.com/drive/api/v2/reference/files/trash)
instead of
Expand Down
28 changes: 26 additions & 2 deletions content/docs/user-guide/setup-google-drive-remote.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,19 +194,43 @@ authentication is needed.
On the first usage of a GDrive [remote](/doc/command-reference/remote), for
example when trying to `dvc push` for the first time after adding the remote
with a [valid URL](#url-format), DVC will prompt you to visit a special Google
authorization web page. There you'll need to sign into your Google account. The
authentication web page. There you'll need to sign into your Google account. The
[auth process](https://developers.google.com/drive/api/v2/about-auth) will ask
you to grant DVC the necessary permissions, and produce a verification code
needed for DVC to complete the connection. On success, the necessary credentials
will be saved in a Git-ignored file, located in
`.dvc/tmp/gdrive-user-credentials.json`.
`.dvc/tmp/gdrive-user-credentials.json` and they will be used automatically next
time you run DVC.

⚠️ In order to prevent unauthorized access to your Google Drive, **do not share
these credentials with others**. Each team member should go through this process
individually.

If you use multiple GDrive remotes, by default they will be sharing the same
`.dvc/tmp/gdrive-user-credentials.json` credentials file. It can be overridden
with the `gdrive_user_credentials_file` setting:

```dvc
$ dvc remote modify myremote gdrive_user_credentials_file \
.dvc/tmp/myremote-credentials.json
```

> If you edit the config file manually, value must be either an absolute path or
> a path **relative to the config file location**.
⚠️ In order to prevent unauthorized access to your Google Drive, **never
commit** this file with Git. Instead, add it into `.gitignore` and never share
it with other people.

If you wish to change the user you have authenticated with, or for
troubleshooting misc. token errors, simply remove the user credentials JSON file
and authorize again.

Alternatively, a `GDRIVE_CREDENTIALS_DATA` can be set to pass user credentials
in CI/CD systems, production setup, read-only file systems, etc. Content of this
variable should be a string with JSON that has the same format as in the
credentials files described above and usually you get it going through the same
authentication process. DVC reads this variable first, before the credentials
file.

> Please note our [Privacy Policy (Google APIs)](/doc/user-guide/privacy).

0 comments on commit cba33a3

Please sign in to comment.