How to use posh-git that comes with GitHub for Windows from custom shell?

前端 未结 3 1148
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-30 09:41

Installing GitHub for Windows is a nice way to get at once beginner\'s git Windows app, msysgit and posh-git - but you can only start the git shell with posh-git by calling \"Gi

3条回答
  •  故里飘歌
    2021-01-30 10:14

    Though @dahlbyk answer did not provide resolution, it still pushed me in the right direction. The problem is, $env:posh-git environment referenced in the Phil's Haack blog post is not defined, so testing it in the PowerShell profile script does nothing.

    What works though is running shell.ps1 and profile.example.ps1 from the same script. Here is the recipe for PowerShell noobs like me:

    1. Edit or create Microsoft.PowerShell_profile.ps1 in active user's Documents\WindowsPowerShell folder (create the folder if it does not exist)
    2. Add the following 2 lines:

      . (Resolve-Path "$env:LOCALAPPDATA\GitHub\shell.ps1")
      . $env:github_posh_git\profile.example.ps1
      

提交回复
热议问题