Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seeing "fatal: Refusing to point HEAD outside of refs/" after every command I run in the terminal

Tags:

fish

I haven't used the terminal in a few weeks, after running "Brew Upgrade" to upgrade/update all my packages, I started seeing "fatal: Refusing to point HEAD outside of refs/" after every command I run. I'm not that versed with the terminal or Git, so I have no idea what this means, please offer some suggestions/scenarios for why this may be happening.

like image 573
Ricky H. Avatar asked Dec 01 '22 13:12

Ricky H.


1 Answers

I'll bet that you are using the fish shell, and upgraded to version 3.3.0 when you ran brew upgrade.

I'll also bet that you have a custom prompt running a command with error redirection using the circumflex diacritic (^). This is no longer a valid syntax :

Redirection to standard error with the ^ character has been disabled by default. It can be turned back on using the stderr-nocaret feature flag, but will eventually be disabled completely (#7105).

The solution is to replace all the ^ used for error redirection in your config with 2>.

For example :

git symbolic-ref HEAD ^/dev/null

becomes

git symbolic-ref HEAD 2>/dev/null

All credit to Njke on this GitHub issue.

like image 122
Guillaume Algis Avatar answered May 14 '23 19:05

Guillaume Algis