[英]Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder
我想從cmder powershell中使用git。
Cmder打印出以下錯誤:
缺少git支持,請使用“安裝模塊posh-git”安裝posh-git並重新啟動cmder
如果我運行Install-Module posh-git
cmder,則會打印出下一個錯誤:
- 安裝模塊<<<< posh-git
- CategoryInfo:ObjectNotFound:(安裝模塊:字符串)[],CommandNotFoundException
- FullyQualifiedErrorId:CommandNotFoundException
cmder/vendor/git-for-windows
中的文件替換為“ Git for Windows”中已安裝的文件 我的git命令正在運行,但是沒有顯示我正在處理的分支。
那么我該如何解決呢?
此答案適用於不需要posh-git的情況。 posh-git可能會大大延遲提示的顯示。
在cmder配置文件(\\ vendor \\ profile.ps1)文件中,在函數“ checkGit”中注釋掉以下幾行。
function checkGit($Path) {
#if (Test-Path -Path (Join-Path $Path '.git')) {
# $gitLoaded = Import-Git $gitLoaded
# Write-VcsStatus
# return
#}
注意:很抱歉,此答案無法回答查看當前分支的原始請求。 我認為這種解決方案可能更適合某些人。
更新:
這是一個更好的解決方案,不需要在每次更新cmder時重新應用它:
將以下功能添加到\\ config \\ user_profile.ps1(我的巧克力狀安裝文件的完整路徑為c:\\ tools \\ cmdermini \\ config \\ user_profile.ps1):
function checkGit() {}
您的CommandNotFoundException是因為Install-Module
需要Install-Module
Powershell 3.0或PSGet
。 但是,手動安裝應該起作用。
驗證文件posh-git.psm1
是否位於$env:PSModulePath
。 然后重新啟動PowerShell並運行Import-Module posh-git
。 這應該迫使它找到模塊。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.