用于GitHub设置的Powershell

Ren*_*aud 6 powershell github-for-windows

我刚刚为Windows安装了GitHub,为方便起见,我在Windows资源管理器的上下文菜单中添加了powershell的条目.注册表命令是:

C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe -NoExit 
C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -NoExit -Command Set-Location -LiteralPath '%L'
Run Code Online (Sandbox Code Playgroud)

正如在shell.ps1中所建议的,我在我的profilehell环境中添加了".(Resolve-Path"$ env:LOCALAPPDATA\GitHub\shell.ps1")"到我的profile.ps1以获取poshgit和其余的设置.虽然它并没有完全发挥作用.我可以看到shell.ps1被执行了(当运行"$ env:github_posh_git"时,我看到正确的值出现)但是当我导航到git repo时,我没有看到增强的提示.

我错过了什么?

PS:Powershell的唯一版本我带了GitHub for windows,即使文件夹说"1.0"正在运行

 $psversiontable.psversion
Run Code Online (Sandbox Code Playgroud)

Major  Minor  Build  Revision
-----  -----  -----  --------
2      0      -1     -1
Run Code Online (Sandbox Code Playgroud)

Ren*_*aud 4

我从 GitHub 支持处得到了答案:

增强的提示符由 posh-git [1] 提供,当您运行 shell.ps1 中的行时不会添加它。然而,它的安装很容易。

只需 cd 到 C:\Users\Username\AppData\GitHub\PoshGit_* 并从 PowerShell 运行 install.ps1 脚本。它会自动将其添加到您的 PowerShell $profile 中。