如何在代理后面使用install_github?

问题描述 投票:3回答:1

我终于使用以下代码设法使我的代理设置适用于GitHub克隆:

options(rsconnect.http = "internal")
Sys.setenv(http_proxy  = "http://proxy.lala.blabla:8080")
Sys.setenv(https_proxy = "https://proxy.lala.blabla:8080")

我现在可以使用File> New Project> Version control来克隆github项目。

但我无法从github安装:'(

require(devtools)
install_github("this/that")
--> Installation failed: Could not resolve host: raw.githubusercontent.com

人们似乎使用以下命令:

http::set_config(use_proxy(...))

但这会迫使我明确写下我的登录/通行证,我不想这样做。我宁愿使用与之关联的默认值

options(rsconnect.http = "internal")

如何在此处配置代理,而无需编写登录/通行证?

r proxy install devtools httr
1个回答
1
投票

devtools在引擎盖下使用httr,例如devtools:::remote_package_name.github_remotedevtools:::remote_download.github_remote。 这就是为什么它要求您以httr::set_config(httr::use_proxy(...))方式设置代理。

我建议您只从环境变量中获取信息并将元素传递给httr::set_config(httr::use_proxy(...))。然后,您无需在代码中键入设置。

© www.soinside.com 2019 - 2024. All rights reserved.