git - 安装模块的代理问题

标签 git powershell posh-git

运行以下设置:

  • 服务器 2012 R2
  • PS版本:4.0
  • WSManStack 版本:3.0
  • Git 版本 2.11.1
  • 包管理预览 - x64:10.0.10586.117
  • SharpZipLib:0.86.0
  • NuGet:2.8.5.208

  • 尝试安装 posh-git 模块给出:
    PowerShellGet\Install-Module posh-git -Scope CurrentUser
    

    但是得到

    PackageManagement\Install-Package : No match was found for the specified search criteria and module name 'posh-git'.



    尝试 Get-PackageSource 时和 Get-PSRepository我明白了

    WARNING: Unable to find package sources





    WARNING: Unable to find module repositories.



    我坐在 TMG 代理后面并尝试使用 -Proxy切换和设置设置 winttp 代理没有运气。

    最佳答案

    根据 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"
    

    关于git - 安装模块的代理问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42239705/

    相关文章:

    git - 正在执行 VCS 刷新...(耗时太长或从未完成)

    powershell - PowerShell变量 `${$}`, `${^}`和 `$?`

    powershell - 从事件消息中选择一些字符串

    powershell - 在 Visual Studio 包管理器中安装 posh-git

    powershell - 设置 PowerShell posh-git 的 WindowTitle - 转义连字符?

    Git 从另一个没有历史记录的存储库中 pull

    git - 如何在 Git 存储库中找到具有多个父级的所有提交?

    git - 如何编辑过去的 git 提交以从提交日志中删除我的密码?

    powershell - 从 cmd 调用 powershell 命令时出错

    visual-studio - posh-git 在包管理器控制台中不显示分支