问题描述
我为 Windows PowerShell 安装了 posh-git,它在 shell 中运行良好.但是,它也应该在包管理器控制台中工作.它确实有效,但它不像普通的 powershell 窗口那样显示当前分支.
我遵循了
您只能在 VS 2012 包管理器控制台中看到 PM>
.
但它在 powershell 中运行良好.
Nuget 有一个单独的配置文件 (~\Documents\WindowsPowerShell\NuGet_profile.ps1),因此它不会选择安装在默认配置文件中的 posh-git.
让 posh-git 工作的最简单方法是从包管理器控制台运行 install.ps1
.或者,如果您总是希望您的配置文件匹配,您可以在 Nuget one 中加载您的默认配置文件:
$PROFILEDIR = (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)推送位置 $PROFILEDIR..\Microsoft.PowerShell_profile.ps1流行位置
(编辑为包括切换到配置文件目录;在 $PROFILEDIR
中捕获位置是可选的,但我觉得它很方便.)
I installed posh-git for Windows PowerShell and it works great in the shell. However, it is supposed to work in the package manager console as well. It does work but it doesn't show the current branch like the normal powershell window does.
I followed this tutorial and everything went fine except for my package manager console doesn't look like his with the branch name.
All you can see is PM>
in the VS 2012 package manager console.
But it works fine in the powershell.
Nuget has a separate profile (~\Documents\WindowsPowerShell\NuGet_profile.ps1), so it's not picking up the posh-git installed in your default profile.
The easiest way to get posh-git working is to run install.ps1
from the Package Manager Console. Or if you always want your profiles to match, you can load your default profile in the Nuget one:
$PROFILEDIR = (Split-Path -Path $MyInvocation.MyCommand.Definition -Parent)
Push-Location $PROFILEDIR
. .\Microsoft.PowerShell_profile.ps1
Pop-Location
(Edited to include switching to profile directory; capturing location in $PROFILEDIR
is optional, but I find it handy.)
这篇关于posh-git 不在包管理器控制台中显示分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!