This has been fixed for newer Mac OS version but some years ago I still regularly experienced a problem with git every time the OS got an update. There is this rant from some years back, the message is that I periodically had to run
$ xcode-select --install
to fix git among other things. I had installed git with homebrew.