Skip to content

Commit 2b789bf

Browse files
committed
gdrive: update docs
1 parent fc45e12 commit 2b789bf

File tree

5 files changed

+96
-43
lines changed

5 files changed

+96
-43
lines changed

public/static/docs/command-reference/remote/add.md

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -194,50 +194,12 @@ $ dvc remote add myremote "azure://"
194194

195195
### Click for Google Drive
196196

197-
Since Google Drive has tight API usage quotas, creation and configuration of
198-
your own `Google Project` is required:
199-
200-
1. Log into the [Google Cloud Platform](https://console.developers.google.com)
201-
account.
202-
2. Create `New Project` or select available one.
203-
3. Click `ENABLE APIS AND SERVICES` and search for `drive` to enable
204-
`Google Drive API` from search results.
205-
4. Navigate to
206-
[All Credentials](https://console.developers.google.com/apis/credentials)
207-
page and click `Create Credentials` to select `OAuth client ID`. It might
208-
ask you to setup a product name on the consent screen.
209-
5. Select `Other` for `Application type` and click `Create` to proceed with
210-
default `Name`.
211-
6. `client id` and `client secret` should be showed to you. Use them for
212-
further DVC's configuration.
197+
> 💡 Before adding a Google Drive remote, be sure to check
198+
> [Setup Google Drive Remote](/doc/user-guide/setup-google-drive-remote) user
199+
> guide.
213200
214201
```dvc
215-
$ dvc remote add myremote gdrive://root/my-dvc-root
216-
$ dvc remote modify myremote gdrive_client_id my_gdrive_client_id
217-
$ dvc remote modify myremote gdrive_client_secret gdrive_client_secret
218-
```
219-
220-
On first usage of the remote you will be prompted to visit an access token
221-
generation URL via browser. It will ask you to log into the Google account
222-
associated with the Google Drive you want to use as remote. The login process
223-
will guide you through the granting of the required access permissions.
224-
225-
On successful access token generation, the token data will be cached in a
226-
Git-ignored directory (located in `.dvc/tmp/gdrive-user-credentials.json`).
227-
228-
> 💡 Do not share the token data with anyone else to prevent unauthorized access
229-
> to your Google Drive.
230-
231-
**Support for shared drives**
232-
233-
For this, you need to obtain the directory ID and use it as part of URL passed
234-
to DVC. This ID can be found in your web browser address bar when the shared
235-
drive is opened. For example, for the URL
236-
`https://drive.google.com/drive/folders/0AIac4JZqHhKmUk9PDA`, use
237-
`0AIac4JZqHhKmUk9PDA` as ID:
238-
239-
```dvc
240-
$ dvc remote add myremote gdrive://0AIac4JZqHhKmUk9PDA/my-dvc-root
202+
$ dvc remote add -d myremote gdrive://root/path/to/dir
241203
```
242204

243205
</details>

public/static/docs/sidebar.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,8 @@
159159
{
160160
"label": "Anonymized Usage Analytics",
161161
"slug": "analytics"
162-
}
162+
},
163+
"setup-google-drive-remote"
163164
]
164165
},
165166
{
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Setup Google Drive remote
2+
3+
To setup Google Drive remote you should
4+
[create and configure Google Project](#create-and-configure-google-project) if
5+
you don't have one yet.
6+
7+
## Create and Configure Google Project
8+
9+
Since Google Drive has tight API usage quotas, one time creation and
10+
configuration of your own `Google Project` is required. Required `client_id` and
11+
`client_secret` can be generated only once and shared with other DVC users in
12+
your organization.
13+
14+
1. Log into the [Google Cloud Platform](https://console.developers.google.com)
15+
account.
16+
2. Create `New Project` or select available one.
17+
3. From the left sidebar menu select `APIs & Services`->`Dashboard` and click
18+
`ENABLE APIS AND SERVICES` to search for `drive` to enable
19+
`Google Drive API` from search results.
20+
21+
![](/static/img/gdrive-enable-apis-and-services.png)
22+
23+
4. From the left sidebar menu select `APIs & Services`->`Credentials` and click
24+
`Create Credentials` to select `OAuth client ID`. It might ask you to setup
25+
a product name on the consent screen. Complete all required steps.
26+
27+
![](/static/img/gdrive-create-credentials.png)
28+
29+
5. Select `Other` for `Application type` and click `Create` to proceed with
30+
default `Name`.
31+
6. `client id` and `client secret` should be showed to you. Use them for
32+
further DVC's configuration.
33+
34+
```dvc
35+
$ dvc remote add -d myremote gdrive://path # see URL format section below
36+
$ dvc remote modify myremote gdrive_client_id my_gdrive_client_id
37+
$ dvc remote modify myremote gdrive_client_secret gdrive_client_secret
38+
```
39+
40+
⚠️ It is safe to share `client_id` and `client_secret` at least with your
41+
teammates or inside organization. These credentialds are used to
42+
[retrieve authorization token](https://developers.google.com/identity/protocols/OAuth2)
43+
and
44+
[authenticate your application](https://developers.google.com/drive/api/v2/about-auth)
45+
to Google. Credentialds don't give access to your Google Drive storage. But
46+
Google limits global number of queires per each `client_id` and uncontrolled
47+
usage of your `cliend_id` by outer world can lead to
48+
[reaching the allowed Google API usage limits](https://developers.google.com/drive/api/v2/handle-errors?hl=ro#quota).
49+
50+
## Google Drive remote URL format
51+
52+
Remote URL can contain `root` which is an alias of your topmost Google Drive
53+
directory. To point the remote to the path under Google Drive's `root`
54+
directory:
55+
56+
```dvc
57+
$ dvc remote add -d myremote gdrive://root/path/to/dir
58+
```
59+
60+
As alternative, you can obtain unique `Google Drive id` of your desired remote
61+
directory and use it as `base` remote path in URL:
62+
63+
```dvc
64+
$ dvc remote add -d myremote gdrive://0AIac4JZqHhKmUk9PDA/path/to/dir
65+
```
66+
67+
To obtain `Google Drive id` of remote directory navigate inside that directory
68+
in your web browser with opened Google Drive and find `Google Drive id` in
69+
address bar. For example, for the URL
70+
71+
```dvc
72+
https://drive.google.com/drive/folders/0AIac4JZqHhKmUk9PDA
73+
```
74+
75+
the `id` will be equal to `0AIac4JZqHhKmUk9PDA`.
76+
77+
`Shared Team Drive` can be referenced by `Google Drive id` in the similar way.
78+
79+
## Authorization
80+
81+
On first usage of remote you will be prompted to visit access token generation
82+
link in browser. It will ask you to log into Google account associated with
83+
Google Drive, which you want to use as DVC's remote. Login process will guide
84+
you through granting Google Drive access permissions to the used Google Project.
85+
86+
On successful access token generation token data will be cached in git ignored
87+
directory with path `.dvc/tmp/gdrive-user-credentials.json`.
88+
89+
⚠️ Do not share token data with anyone else to prevent unauthorized access to
90+
your Google Drive.
51.7 KB
Loading
23.2 KB
Loading

0 commit comments

Comments
 (0)