Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder

Fabian Schmick picture Fabian Schmick · Mar 4, 2016 · Viewed 9k times · Source

I want to work with git, from the cmder powershell.

Errors

Cmder prints out the following error:

Missing git support, install posh-git with 'Install-Module posh-git' and restart cmder

If I run the Install-Module posh-git cmder prints out the next error:

  • Install-Module <<<< posh-git
    • CategoryInfo : ObjectNotFound: (Install-Module:String) [], CommandNotFoundException
    • FullyQualifiedErrorId : CommandNotFoundException

Things I have done/tried

Problem

My git commands are working, but not showing me the branch I am working on.

So how can I fix this?

Answer

Josh picture Josh · Nov 8, 2017

This answer is for when posh-git is not wanted. posh-git can introduce significant delays to the prompt's display.

In the cmder profile (\vendor\profile.ps1) file, comment out the following lines in the function "checkGit".

function checkGit($Path) {
    #if (Test-Path -Path (Join-Path $Path '.git')) {
    #    $gitLoaded = Import-Git $gitLoaded
    #    Write-VcsStatus
    #    return
    #}

Note: Sorry, this answer doesn't answer the original request to see the current branch. I think that this solution may be a better fit for some people.

Update:

Here's a better solution that won't need to be reapplied every time that cmder is updated:

Add the following function to \config\user_profile.ps1 (the full path for my chocolatey installation file is c:\tools\cmdermini\config\user_profile.ps1):

function checkGit() {}