Fixed – [oh-my-zsh] Can’t update: not a git repository.

This week I upgraded my Macbook to the latest version and since the update, I realized that every time I opened a new terminal I had this warning issue from Oh-my-Zsh.

[oh-my-zsh] Can't update: not a git repository.

If you search a bit, there are several messages explaining that this error may be due to the application folder has been messed up and the .git folder being lost.

It wasn’t my case:

❯ cd .oh-my-zsh
❯ ls -la

...
drwxr-xr-x   14 ruben  staff    448  4 nov 10:25 .git
drwxr-xr-x    7 ruben  staff    224  4 nov 10:18 .github
-rw-r--r--    1 ruben  staff    102  4 nov 10:18 .gitignore
-rw-r--r--    1 ruben  staff    131 14 abr  2022 .gitpod.Dockerfile
-rw-r--r--    1 ruben  staff    259 14 abr  2022 .gitpod.yml
...

The hint to find the fix came when I tried to update oh-my-zsh I got this error message:

❯ omz update

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Searching a bit more, you can find that the error is due that you have to accept again the license term of the macOS command line developer tools.

To fix it, you just need to run this command:

❯ xcode-select --install

A popup will appear asking if you want to install the tools.
After finishing the installation you should be able to update Oh-my-Zsh and the «Can’t update – not a git repository» won’t appear again.

❯ omz update

Updating Oh My Zsh
master
...

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *