本文档翻译自:https://docs.conan.io/en/latest/reference/commands/misc/remote.html
$ conan remote [-h]
{list,add,remove,update,rename,list_ref,add_ref,remove_ref,update_ref,list_pref,add_pref,remove_pref,update_pref,clean,enable,disable}
...
管理远程列表和与远程关联的软件包配方。
positional arguments:
{list,add,remove,update,rename,list_ref,add_ref,remove_ref,update_ref,list_pref,add_pref,remove_pref,update_pref,clean,enable,disable}
sub-command help
list List current remotes
add Add a remote
remove Remove a remote
update Update the remote url
rename Update the remote name
list_ref List the package recipes and its associated remotes
add_ref Associate a recipe's reference to a remote
remove_ref Dissociate a recipe's reference and its remote
update_ref Update the remote associated with a package recipe
list_pref List the package binaries and its associated remotes
add_pref Associate a package reference to a remote
remove_pref Dissociate a package's reference and its remote
update_pref Update the remote associated with a binary package
clean Clean the list of remotes and all recipe-remote
associations
enable Enable a remote
disable Disable a remote
optional arguments:
-h, --help show this help message and exit
Examples
远程服务器列表
$ conan remote list
conan-center: https://conan.bintray.com [Verify SSL: True]
local: http://localhost:9300 [Verify SSL: True, Disabled: True]
以几乎对remotes.txt有效的格式列出遥控器,以便与conan config install一起使用,只需要删除附加到禁用的遥控器的True布尔值(输出中的本地提示栏):
$ conan remote list --raw
conan-center https://conan.bintray.com True
local http://localhost:9300 True True
# capture the current remotes in a text file
$ conan remote list --raw > remotes.txt
添加一个新的远程服务器:
$ conan remote add remote_name remote_url [verify_ssl]
验证SSL选项可以为True或False(默认为True)。 柯南客户端将验证SSL证书。
插入一个新的远程服务器:
作为第一个插入(位置/索引0),因此它是首个被检索的:
$ conan remote add remote_name remote_url [verify_ssl] --insert
作为第二个插入(位置/索引1),因此它是要检查的第二个:
$ conan remote add remote_name remote_url [verify_ssl] --insert=1
- 添加或插入一个远程服务器
将—force参数添加到柯南远程添加中将始终有效,并且不会引发错误。 如果存在具有该远程名称或URL的现有远程,它将使用新信息进行更新。 —insert的工作原理相同。 如果未指定,则遥控器将附加到最后一个遥控器。 如果指定,该命令会将遥控器插入指定位置
$ conan remote add remote_name remote_url [verify_ssl] --force --insert=1
移除一个远程服务器
$ conan remote remove remote_name
删除所有已配置的遥控器(这还将删除所有配方-远程关联):
$ conan remote clean
更新远程服务器:
$ conan remote update remote_name new_url [verify_ssl]
重命名远程服务器
$ conan remote rename remote_name new_remote_name
将现有的遥控器更改为第一个位置:
$ conan remote update remote_name same_url --insert 0
列出软件包配方及其关联的远程服务器:
$ conan remote list_ref
bzip2/1.0.6@lasote/stable: conan.io
Boost/1.60.0@lasote/stable: conan.io
zlib/1.2.8@lasote/stable: conan.io
将配方的参考关联到指定远程服务器:
$ conan remote add_ref openssl/1.0.2u conan-center
更新与软件包配方关联的遥控器:
$ conan remote update_ref openssl/1.0.2t local-remote
启用或禁用远程服务器(使用Unix Shell样式通配符接受诸如*之类的模式作为参数):
$ conan remote disable "*"
$ conan remote enable local-remote
:::info
Note
选中“如何管理SSL(TLS)证书”部分,以了解有关服务器证书验证和客户端证书管理的更多信息。
:::