在 GitHub 上编辑
HTTP
使用 dvc remote add
命令定义远程存储:
$ dvc remote add -d myremote https://example.com/path
配置参数
如果以下参数包含敏感用户信息,请使用 --local
选项添加,以确保它们被写入 Git 忽略的配置文件中。
-
url
- 远程位置:$ dvc remote modify myremote url https://example.com/path
URL 可以包含查询字符串,该字符串将被保留(例如
example.com?loc=path%2Fto%2Fdir
) -
auth
- 访问远程存储时使用的认证方法。可接受的值包括:basic
- 基本认证方案。还应配置user
和password
(或ask_password
)参数。digest
(在 2.7.1 版本中已移除)- 摘要访问认证方案。还应配置user
和password
(或ask_password
)参数。custom
- 将为所有发往远程存储的 HTTP 请求设置一个额外的 HTTP 头字段,格式为:custom_auth_header: password
。还应配置custom_auth_header
和password
(或ask_password
)参数。
$ dvc remote modify myremote auth basic
-
method
- 覆盖用于文件上传的HTTP 方法(例如,Artifactory 应使用PUT
)。默认使用POST
。$ dvc remote modify myremote method PUT
-
custom_auth_header
- 当auth
参数设置为custom
时,要使用的 HTTP 头字段名称。$ dvc remote modify --local myremote \ custom_auth_header 'My-Header'
-
user
- 当auth
参数设置为basic
时,要使用的用户名。$ dvc remote modify --local myremote user myuser
DVC 选择用户名的顺序如下:
- 通过此命令设置的
user
参数(位于.dvc/config
中); - URL 中定义的用户(例如
http://user@example.com/path
);
- 通过此命令设置的
-
password
- 用于任何auth
方法的密码。$ dvc remote modify --local myremote password mypassword
-
ask_password
- 每次都提示输入用于任何auth
方法的密码。$ dvc remote modify myremote ask_password true
请注意,
password
参数优先于ask_password
。如果指定了password
,DVC 将不会为此远程存储提示用户输入密码。 -
ssl_verify
- 是否验证 SSL 证书,或指定自定义 CA 证书包的路径(默认为true
)。$ dvc remote modify myremote ssl_verify false # or $ dvc remote modify myremote ssl_verify path/to/ca_bundle.pem
-
read_timeout
- 设置从连接读取数据片段时抛出超时异常的秒数(默认为 60 秒)。例如,将其设置为 5 分钟:$ dvc remote modify myremote read_timeout 300
-
connect_timeout
- 设置建立连接时抛出超时异常的秒数(默认为 60 秒)。例如,将其设置为 5 分钟:$ dvc remote modify myremote connect_timeout 300