JanDeDobbeleer / oh-my-posh

The most customisable and low-latency cross platform/shell prompt renderer
https://ohmyposh.dev
MIT License
17.38k stars 2.39k forks source link

Git Bash Error #1494

Closed Rafi-99 closed 2 years ago

Rafi-99 commented 2 years ago

Code of Conduct

What happened?

bash: oh-my-posh: command not found

This is the error I get whenever I startup Git Bash. I am not sure why it is saying not found.

image

I get the same issue in the integrated terminal of VSCode too.

image

However, in Windows Terminal, the theme loads as expected:

image image

P.S. This is a separate question, but I am struggling to enable oh-my-posh for Windows Command Prompt. Could someone guide me on how to go about doing so?

Theme

microverse-power

What OS are you seeing the problem on?

Windows

Which shell are you using?

bash

Log output

bash: oh-my-posh: command not found
JanDeDobbeleer commented 2 years ago

@Rafi-99 how did you install oh-my-posh? Because if you want it to be available, it needs to be in your PATH.

Rafi-99 commented 2 years ago

@JanDeDobbeleer Oh wow! Thank you for replying so fast!

At first, I installed it using PowerShell. Then I ended up installing it using chocolatey. I believe I have 2 installations of oh-my-posh on my machine since I got confused.

How do I add it to my path correctly?

JanDeDobbeleer commented 2 years ago

@Rafi-99 I suggest to install using Winget or scoop. That's official and will also add it to PATH. You can follow the guide for Windows here, that also contains all you need to know for CMD. First, uninstall the current ones so there's no conflicts possible.

Rafi-99 commented 2 years ago

@JanDeDobbeleer Alright, thank you so much! I will let you know how it goes.

Rafi-99 commented 2 years ago

@JanDeDobbeleer I installed it using Winget as you suggested. Got it working in Powershell natively. Windows Terminal profiles for Powershell and Git Bash work. However, the original issue of the native Git Bash and VSCode integrated terminal is still not working.

image

Could you guide me to where I should look next?

JanDeDobbeleer commented 2 years ago

The only thing I can think off is either the Profile which is different on vscode and/or the PATH that doesn't contain the right entry for oh-my-posh.

Rafi-99 commented 2 years ago

@JanDeDobbeleer Okay, thanks. For the native Git Bash issue, do you suggest looking at the PATH as well?

image

I do have oh-my-posh in my PATH correctly I think. The scope is user and not system though

image

Lastly, I have this in my .bashrc

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

Appreciate any help you can provide.

Rafi-99 commented 2 years ago

Never mind, I believe I have fixed the issue. The issue was with Git Bash not finding the required variables in my path at all. Maybe all I needed was a reboot, but adding this one-liner to my .bashrc saved the day!

PATH=$PATH:/c/Users/rafim/AppData/Local/Programs/oh-my-posh/bin

Now, it's working as intended :)

image image

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.