2017-02-15 355 views
1

运行以下设置:代理问题与安装模块

  • 服务器2012 R2
  • PSVersion:4.0
  • WSManStackVersion:3.0
  • Git版本2.11.1
  • 软件包管理预览 - 64 :10.0.10586.117
  • SharpZipLib:0.86.0
  • NuGet:2.8.5.2 08

要安装的豪华-git的模块为:

PowerShellGet\Install-Module posh-git -Scope CurrentUser 

但要

PackageManagement \安装,包装:未找到匹配 指定的搜索条件和模块名字'posh-git'。

当试图Get-PackageSourceGet-PSRepository我得到

警告:无法找到包源

警告:无法找到模块的存储。

我坐在一个TMG代理后面,试着用-Proxy开关和设置winttp代理没有运气。每基思·希尔的建议

+1

尝试手动添加PowerShellGallery回购'重新设置gister-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2/ -Proxy ... -ProxyCredential(Get-Credential)'。如果可行,请确保'Get-PSRepository'返回新注册的仓库。 –

+0

感谢Keith,最终这样做了。 我已经在机器的代理中发现了异常,并注意到PowerShell 5.1在这方面似乎更容易配置。 – J1raya

回答

1

A,加入PowerShellGallery回购手动工作:

Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2 

我有麻烦与-proxy开关这方面的工作,所以我设置过的netsh其中的伎俩代理:

netsh winhttp set proxy proxy-server="http=myproxy:8080" 
1

代理可以通过-Proxy参数许多网络的cmdlet或$PSDefaultParameterValues = @{ "*:Proxy"="http://proxy:port" }