在 GitHub 上编辑
WebDAV
使用 dvc remote add
命令定义远程存储:
$ dvc remote add -d myremote \
webdavs://example.com/owncloud/remote.php/dav
如果您的远程存储位于 WebDAV 服务器的子目录中,例如 files/myuser
,可将该路径附加到基础 URL 上:
$ dvc remote add -d myremote \
webdavs://example.com/owncloud/remote.php/dav/files/myuser
配置参数
如果以下参数包含敏感用户信息,请使用 --local
选项添加,以确保它们被写入 Git 忽略的配置文件中。
-
url
- 远程位置:$ dvc remote modify myremote url \ webdavs://example.com/nextcloud/remote.php/dav/files/myuser/
-
token
- WebDAV 服务器的令牌,若使用user/password
认证方式,则可为空。$ dvc remote modify --local myremote token 'mytoken'
-
user
- WebDAV 服务器的用户名,若使用token
认证方式,则可为空。$ dvc remote modify --local myremote user myuser
DVC 搜索用户名的顺序如下:
- 通过此命令设置的
user
参数(位于.dvc/config
中); - URL 中定义的用户(例如
webdavs://user@example.com/endpoint/path
)
- 通过此命令设置的
-
custom_auth_header
- 用于认证的 HTTP 头字段名称。其值通过password
设置。$ dvc remote modify --local myremote \ custom_auth_header 'My-Header'
-
password
- WebDAV 服务器的密码,需与user
或custom_auth_header
配合使用。若使用token
认证方式,则留空。$ dvc remote modify --local myremote password mypassword
基于
user
或custom_auth_header
(配合password
)的认证方式与token
认证方式不兼容。 -
ask_password
- 每次都提示输入用于user/password
认证的密码。如果已设置password
或token
,则此选项无效。$ dvc remote modify myremote ask_password true
-
ssl_verify
- 是否验证 SSL 证书,或指定自定义 CA 证书包的路径(默认为true
)。$ dvc remote modify myremote ssl_verify false # or $ dvc remote modify myremote ssl_verify path/to/ca_bundle.pem
-
cert_path
- 用于 WebDAV 服务器认证的证书路径,适用于需要使用本地客户端证书的情况。$ dvc remote modify --local myremote cert_path /path/to/cert
-
key_path
- 访问远程存储时使用的私钥路径。仅在与cert_path
同时使用时生效。$ dvc remote modify --local myremote key_path /path/to/key
请注意,
cert_path
中的证书可能已包含私钥。 -
timeout
- WebDAV 服务器的连接超时时间(单位:秒,默认值:30)。$ dvc remote modify myremote timeout 120