Skip to content

gdrive: add gdrive_user_credentials_file description #1192

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Comment on lines +202 to +203
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`.dvc/tmp/gdrive-user-credentials.json` and they will be used automatically next
time you run DVC.
`.dvc/tmp/gdrive-user-credentials.json` by default, and they will be loaded
automatically next time you use the same GDrive remote.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not exactly true, they can be used for multiple remotes if you don't specify an option gdrive_user_credentials_file

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it. But "run DVC" doesn't sound exact either. How about

Suggested change
`.dvc/tmp/gdrive-user-credentials.json` and they will be used automatically next
time you run DVC.
`.dvc/tmp/gdrive-user-credentials.json` by default, and they will be loaded
automatically next time you use this or other GDrive remotes.

Maybe even continue this paragraph with the explanation about how to overwrite it, instead of a separate paragraph that repeats the file name.


⚠️ 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
Comment on lines +209 to +210
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we don't need to repeat the file name since it's mentioned in in the previous paragraph (before the warning).

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).