Fix Git issues after upgrading MacOs to Monterey

You’ve installed a new MacOS version but suddently you lost git with the following error :

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

No need to reinstall git or look that way, it’s an issue with Xcode that contains Apple developper tools. You need to reinstall it with the following command :

xcode-select --install

Now you can go for a cup of coffee (or take a nap), this is quite long but it will solve your problem.