问题描述
我在从公司代理后面安装 Chocolatey 软件包时遇到问题.Internet Explorer 已正确配置,但我在通过 Powershell 使其工作时遇到问题.
我可以使用 Web 客户端下载页面,例如Microsoft.com,但最终 Chocolatey 无法通过提示请提供代理凭据:"下载软件包,这将不接受我的域登录有效.有时我只会收到错误异常调用DownloadFile"和2"参数:远程服务器返回错误:(407)需要代理身份验证."
我有两台机器 - 其中一台可以正常下载软件包,另一台出现上述错误,但它们都显示直接访问(如下所示):
PS C:\Windows\system32>netsh winhttp 导入代理源=ie当前 WinHTTP 代理设置:直接访问(无代理服务器).PS C:\Windows\system32>netsh winhttp 显示代理当前 WinHTTP 代理设置:直接访问(无代理服务器).
我不太确定这里发生了什么.有什么建议吗?
Chocolatey 在 https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey,特别是关于显式代理的部分.确保您安装了正确版本的 choco 以使其正常工作.如果这是不正确的,我们应该修复文档/巧克力以使其正确.
为了后代:
显式代理设置
Chocolatey 从 0.9.9.9 开始有明确的代理支持.
您可以简单地配置 1 或 3 个设置,Chocolatey 将使用一个代理服务器.代理是必需的,是位置和端口代理服务器.proxyUser 和 proxyPassword 是可选的.的值用户/密码仅在两者都存在时用作凭据.
choco config set proxy choco config set proxyUser choco config set proxyPassword
示例
在 0.9.9.9 中运行以下命令:
choco config set proxy http://localhost:8888choco config set proxyUser bobchoco 配置设置代理密码 123Sup#rSecur3
I'm having trouble installing Chocolatey packages from behind a corporate proxy. Internet Explorer is correctly configured but I'm having issues getting it to work through Powershell.
I can use the Web-Client to download pages e.g. Microsoft.com, but ultimately Chocolatey fails to download packages with the prompt "Please provide proxy credentials:" which will not accept my domain login as being valid. Sometimes I just get the error "Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (407) Proxy Authentication Required."
I have two machines - one of them can download the packages fine, and the other gives the errors above, but they both show Direct access (as below):
PS C:\Windows\system32> netsh winhttp import proxy source=ie
Current WinHTTP proxy settings:
Direct access (no proxy server).
PS C:\Windows\system32> netsh winhttp show proxy
Current WinHTTP proxy settings:
Direct access (no proxy server).
I'm not too sure what is happening here. Any suggestions?
Chocolatey has proxy instructions at https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey and specifically the section on explicit proxy. Ensure you have the proper version of choco installed for that to work. If that is incorrect, we should fix the documentation/choco to make it correct.
For posterity:
choco config set proxy <locationandport>
choco config set proxyUser <username>
choco config set proxyPassword <passwordThatGetsEncryptedInFile>
choco config set proxy http://localhost:8888
choco config set proxyUser bob
choco config set proxyPassword 123Sup#rSecur3
这篇关于如何配置 Chocolatey 以使用公司代理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!