我有一个旧版本的posh-git,想要更新(试图解决powershell启动缓慢的问题)
我从仓库中拉取了最新版本,当我尝试运行.\install.ps1
时出现以下错误:
It seems posh-git is already installed...
我该如何更新 posh-git?
我有一个旧版本的posh-git,想要更新(试图解决powershell启动缓慢的问题)
我从仓库中拉取了最新版本,当我尝试运行.\install.ps1
时出现以下错误:
It seems posh-git is already installed...
我该如何更新 posh-git?
Update-Module posh-git
它所做的就是查看脚本是否在您的个人资料中被引用:
$profileLine = ". '$installDir\profile.example.ps1'"
if(Select-String -Path $PROFILE -Pattern $profileLine -Quiet -SimpleMatch) {
Write-Host "It seems posh-git is already installed..."
return
}
似乎安装目录是运行安装脚本的文件夹,因此仅通过将新版本的 posh-git 文件夹升级应该已经更新了文件。
如果您对此感到不舒服,只需在个人资料中删除源 profile.example.ps1
的那一行并再次运行安装即可 :)
我之前是通过 PsGet 安装的,所以我重命名了文件夹
C:\Users\[我的用户名]\Documents\WindowsPowerShell\Modules\posh-git
然后重新运行
Install-Module posh-git
它下载了最新版本但告诉我已经安装了,可能是因为我没有从 Microsoft.PowerShell_profile.ps1 中删除这些行。但这已经足够了。