oh-my-fish: fatal: Not a git repository (or any parent up to mount point /)

I just installed (and re-installed just in case) OMF and I am getting these error message every time I start fish or enter any commands:

; exec fish
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
fatal: Not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
⋊> ~ on   ls /                                                          09:46:28
1     boot/  etc/   lib@    media/  opt/   root/  sbin@  srv/  tmp/  var/
bin@  dev/   home/  lib64@  mnt/    proc/  run/   some/  sys/  usr/
fatal: Not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
fatal: Not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

If I enter a directory hosting a git repo, I do get the correct prompt and the error message disappears.

No themes selected, no tweaking of fish, and setting GIT_DISCOVERY_ACROSS_FILESYSTEM only makes that line vanish:

⋊> ~ on   export GIT_DISCOVERY_ACROSS_FILESYSTEM=yes                    09:50:04
fatal: Not a git repository (or any of the parent directories): .git
fatal: Not a git repository (or any of the parent directories): .git

About this issue

  • Original URL
  • State: open
  • Created 7 years ago
  • Comments: 35 (8 by maintainers)

Commits related to this issue

Most upvoted comments

I suddenly got this when upgrading to fish, version 3.3.0 updation omf didn’t work Thanks

In my case the fix was to remove manually omf, and reinstall.

rm -rf ~/.local/share/omf
curl -L https://get.oh-my.fish | fish

I think i had a very very old version, and both the update and the destroy commands were failing.

I got the same issue and found it was related to Redirection to standard error with the ^ character I had a method in fish_prompt.fish which is using^ to redirect stderr.

function _git_branch_name
  echo (command git symbolic-ref HEAD ^/dev/null | sed -e 's|^refs/heads/||')
end

Changed ^ to 2> solved my problem.

For folks still looking for a solution: as per https://github.com/fish-shell/fish-shell/issues/8105#issuecomment-873448774, the shortcut to redirect to stderr no longer works (was deprecated a while back). So replacing ^ with 2> should work in some cases. I’m using Nai and it has worked there.

In my case the fix was to remove manually omf, and reinstall.

rm -rf ~/.local/share/omf
curl -L https://get.oh-my.fish | fish

I think i had a very very old version, and both the update and the destroy commands were failing.

This helped me ^

Downgrading from Fish 3.3.1 to 3.2.2 via Homebrew did the trick for me of solving fatal: Not a git repository (or any of the parent directories): .git when dealing with themes (sushi in my case).

As reference, I did it like…

$ brew uninstall fish
$ brew tap-new $USER/local-tap
$ brew extract --version=3.2.2 fish $USER/local-tap
$ brew install fish@3.2.2

I rather have it named ...@3.2.2 to distinguish it from official formulae’s latest.

Same problem here, after updating to fish 3.3.0. I was using the Acidhub prompt and the Tomorrow Night Bright theme. Changing the prompt back to default and from there back to Acidhub fixed it for me.

Same issue for me:

Welcome to fish, the friendly interactive shell fatal: Not a git repository (or any of the parent directories): .git fatal: Not a git repository (or any of the parent directories): .git

It makes oh-my-fish unusable at the moment.

I had the same issue. Tried all what’s mentioned in this thread with no luck.

Finally, I found the reason: I had some cache files in ~/.cache/omf. I removed them and the error disappeared.

Hope this helps someone

Same issue here with fish version 3.3.0. See https://github.com/fish-shell/fish-shell/issues/5497 on how to downgrade fish (with https://github.com/Homebrew/homebrew-core/commit/fd94b1e4582a9ae9d1466122e3d837ae9c18739d as commit for 3.2.2_1).

Had the same problem with my own theme Zen, since upgrading fish to 3.3.0 and had to add a check if the current folder is a git folder to fix it.

@a-p-o thank you for running that.

I suppose the removal of the .git directory is sufficient. .git is treated as a special directory in regards to git, regardless of if you used git init to create it. I don’t know the specifics but that will definitely create conflicts with most other software if you have $HOME/.git.

If you want to store custom Git configurations then I recommend you put it in a directory like $HOME/.config/git or something similar. Note the removal of the . in .git.

fatal: Not a git repository (or any of the parent directories): .git

I had a .git/ directory (but not git repository) in my home directory. .git/ contained some git configuration. I moved the configuration and removed the .git/ directory and this removed the error message. Hope this helps!

I’m seeing this on a brand new install of omf as well. Any idea what I could do to track down the cause of this error?