themesoh-my-posh

how can I install oh-my-posh in git bash windows terminal


I have installed it in PowerShell and it worked, how can I install oh-my-posh in git bash? I Have installed oh-my-posh with scoop then I added this code to .bashrc:

eval "$(oh-my-posh --init --shell bash --config ~/amro.omp.json)"

but unfortunately didn't work


Solution

  • If your .bashrc doesn't load, it's either not sourced (or the right one). A quick search reveals the following issue:

    OK, I found out the problem. Quite simply, the bash terminal used by the latest Git for Windows 2.5.0 (mintty) doesn't bother to read .bashrc - it reads .bash_profile. So you can set up your environment in .bash_profile and/or put this code at the start to read .bashrc:

    if [ -f ~/.bashrc ]
    then
        . ~/.bashrc
    fi
    

    Secondly, the command needs to be tweaked to this:

    eval "$(oh-my-posh init bash --config ~/amro.omp.json)"
    

    Original answer here.