ohmyzsh: [oh-my-zsh] Can't update: not a git repository.
Describe the bug
Every time I boot up the terminal I get the message [oh-my-zsh] Can't update: not a git repository.
Is there anything to do about this?
Steps to reproduce
1.I open my terminal
2.[oh-my-zsh] Can't update: not a git repository. message pops up
Expected behavior
Usually when I open terminal it asks if I would like to update
Screenshots and recordings
OS / Linux distribution
MacOS 12.3.1
Zsh version
5.8
Oh My Zsh version
N/A
Terminal emulator
terminal.app
If using WSL on Windows, which version of WSL
No response
Additional context
Also when I try to check for Oh My Zsh version it says <detached> ()
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 24 (7 by maintainers)
I had a similar problem this morning, seemed to be in a constant loop of wanting to install. I eventually broke out of it with:
xcodebuild -runFirstLaunchIn my case, it needed to authenticate with PIV card, which it finally prompted for.
On a Mac, if the xcode command-line license agreement has been updated and needs to be accepted, any tool that has dependencies on it can fail. In this case, the ‘git’ command that does the oh-my-zsh update checking is failing.
To solve, issue following and type ‘agree’ to accept the license terms:
sudo xcodebuild -licenseThis solved it for me.
Starting Xcode after updating and agreeing to the license fixed it for me.
The missing xcrun error is solved by running the command posted by Richard above:
Then you can re-run the
git clonecommand above:After that, re-run zsh with
exec zshand you should be good to go.I just had this error today in my MacBook. I found out that I had to agree to the new Xcode license terms
sudo xcodebuild -licensethen it still didn’t work but it warned that I had to reinstall something from Xcode
xcodebuild -runFirstLaunchthat was the solution for me
On a Mac use
sudo xcode-select -switch /Library/Developer/CommandLineToolsafter update.It looks like the OMZ folder is missing the
.gitdirectory. Maybe it got deleted or something. Try reinstalling it by removing the directory and cloning it back in the same place:You should be able to update again after that.
Have you updated the OS since you installed the Xcode command line utilities? If so, reinstall:
xcode-select --installEven if you haven’t, run that anyway just to verify they are current.
Right. This might not be a git problem if you had things workings. One way to check is: $ cd $ZSH $ git log
This fixes:
[oh-my-zsh] Can't update: not a git repository.Background: I’ve been using numerous instances of Xcode, and before the Xcode 14 update, I set the developer path in ZSH to be:
/Applications/Xcode-13.3.1.app/Contents/Developerand I forgot about it. So after the update when the name of Xcode got changed to simplyXcode.app, ZSH did not know where to look for the xcode tools.Running the command suggested above in this thread, has hinted me how to resolve the issue, here’s an excerpt:
git clone --depth=1 https://github.com/ohmyzsh/ohmyzsh.git "${ZSH:-$HOME/.oh-my-zsh}"xcrun: error: active developer path ("/Applications/Xcode-13.3.1.app/Contents/Developer") does not existSolution: And the solution was simple:
sudo xcode-select --switch /Applications/Xcode.app/- before running it, check how Xcode is called in the Applications folder on your machine 😃That’s a lot of faith ZSH is set properly.
If anyone else is running into issues after the macOS 12.6 update, this worked for me:
I kept getting an error loop prompting me to install the Xcode command line tools. It would say it succeeded but then running
git --versionwould throw a bunch of unintelligible nonsense and prompt me to install them again.I ultimately used AppCleaner to locate all of Xcode’s settings folders and delete everything but the Xcode binary itself. I then opened the Xcode app and accepted the install prompts which fixed the CLI tools.
Then I reran the usual oh-my-zsh installer script and everything was dandy!