Git 安装模块的代理问题
运行以下安装程序:Git 安装模块的代理问题,git,powershell,posh-git,Git,Powershell,Posh Git,运行以下安装程序: 服务器2012 R2 PSV:4.0 WSManStackVersion:3.0 Git版本2.11.1 包管理预览-x64:10.0.10586.117 夏普齐普利布:0.86.0 NuGet:2.8.5.208 尝试安装posh git模块会提供: PowerShellGet\Install-Module posh-git -Scope CurrentUser 但是 PackageManagement\Install软件包:未找到匹配项 对于指定的搜索条件和模块名称
- 服务器2012 R2
- PSV:4.0
- WSManStackVersion:3.0
- Git版本2.11.1
- 包管理预览-x64:10.0.10586.117
- 夏普齐普利布:0.86.0
- NuGet:2.8.5.208
PowerShellGet\Install-Module posh-git -Scope CurrentUser
但是
PackageManagement\Install软件包:未找到匹配项
对于指定的搜索条件和模块名称“posh git”
尝试Get PackageSource
和Get PSRepository
时,我得到
警告:找不到包源
及
警告:找不到模块存储库
我坐在一个TMG代理后面,尝试使用
-proxy
开关设置winttp代理,但运气不佳。a根据Keith Hill的建议,手动添加PowerShellGallery回购:
Register-PSRepository -Name PSGallery -SourceLocation https://www.powershellgallery.com/api/v2
我在使用-proxy开关时遇到了问题,因此我通过netsh设置了代理,从而实现了以下目的:
netsh winhttp set proxy proxy-server="http=myproxy:8080"
可以通过许多网络cmdlet的
-Proxy
参数或$PSDefaultParameterValues=@{“*:Proxy”=”设置代理http://proxy:port“}
尝试手动添加PowerShellGallery repo注册PSRepository-Name PSGallery-SourceLocationhttps://www.powershellgallery.com/api/v2/ -代理-代理凭证(获取凭证)
。如果这样做有效,请确保getpsrepository
返回新注册的回购协议。谢谢Keith,这最终成功了。此后,我在我的机器代理中做了一个例外,并注意到PowerShell 5.1在这方面似乎更易于配置。如果您对注册PSRepository
返回错误有问题,请首先运行获取PSRepository
。您可能会发现it is registered不受信任,在这种情况下,您应该使用Set PsRepository