Windows Terminal + oh-my-posh not showing git status
Asked Answered
E

1

8

I have installed oh-my-posh and posh-git in my Windows Terminal, however it does not track any of the git changes as you can see in the picture. Regardless of any changes I have made it just shows like this with no status:

enter image description here

I have also tried without posh-git as I thought oh-my-posh had this functionality by default, but still the same result.

Here's my oh-my-posh theme:

{
  "$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
  "blocks": [
    {
      "alignment": "left",
      "segments": [
        {
          "background": "#91ddff",
          "foreground": "#100e23",
          "powerline_symbol": "",
          "properties": {
            "folder_icon": "",
            "folder_separator_icon": "  ",
            "home_icon": "",
            "style": "agnoster"
          },
          "style": "powerline",
          "type": "path"
        },
        {
          "background": "#95ffa4",
          "foreground": "#193549",
          "powerline_symbol": "",
          "style": "powerline",
          "type": "git"
        },
        {
          "background": "#906cff",
          "foreground": "#100e23",
          "powerline_symbol": "",
          "properties": {
            "prefix": "  "
          },
          "style": "powerline",
          "type": "python"
        },
        {
          "background": "#ff8080",
          "foreground": "#ffffff",
          "powerline_symbol": "",
          "style": "powerline",
          "type": "exit"
        }
      ],
      "type": "prompt"
    }
  ],
  "final_space": true
}

Ep answered 2/7, 2021 at 15:54 Comment(2)
Do you have git installed?Brumfield
@Brumfield Thanks mate! I just came out of format and I haven't yet installed git.Eterne
E
7

Found the answer here: https://ohmyposh.dev/docs/git/. Apparently the git status is disabled by default so you need to add a properties section to the git configuration:

{
  "type": "git",
  "style": "powerline",
  "powerline_symbol": "\uE0B0",
  "foreground": "#193549",
  "background": "#ffeb3b",
  "properties": {
    "display_status": true,
    "display_stash_count": true,
    "display_upstream_icon": true
  }
}

It's also possible to use posh-git:

{
  "type": "poshgit",
  "style": "powerline",
  "powerline_symbol": "\uE0B0",
  "foreground": "#ffffff",
  "background": "#0077c2"
}
Ep answered 2/7, 2021 at 16:4 Comment(1)
Weird, I had didn't have to make any config changes!Brumfield

© 2022 - 2024 — McMap. All rights reserved.