
我使用以下操作成功安裝了 posh-git 1.1.0:
c:\Users\username> PowerShellGet\Install-Module posh-git -Scope CurrentUser -Force
c:\Users\username>
但是當我導航到 git 儲存庫中的 git 資訊時,我在命令列上沒有得到任何資訊:
C:\Users\username> cd .\source\repos\
C:\Users\username\source\repos> cd .\myproj\
C:\Users\username\source\repos\myproj>
我究竟做錯了什麼?
答案1
安裝 posh-git 不會自動使用 posh-git
安裝 posh-git 不會自動為您的設定檔運行它。安裝 posh-git 後,您必須將其匯入到您的會話中才能開始使用 posh-git powershell 會話。您可以使用以下命令將您的設定檔設定為自動使用 posh-git:
C:\Users\username> Add-PoshGitToProfile
然後重新啟動您的 powershell 工作階段。之後,git資訊將顯示在命令列中:
C:\Users\username> cd .\source\repos\
C:\Users\username\source\repos> cd .\myproj\
C:\Users\username\source\repos\myproj [develop ≡]>
查看更多選項使用 Posh-gitposh-git github 儲存庫上的部分。