How to fix git error after updating macOS to Monterey

I updated my macOS version from Big Sur to Monterey and, when I tried to use Git in my terminal I had this problem:

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

Fix this issue by pasting this in your terminal: xcode-select --install.

This would run for about 20-30 minutes and after installation, you should have git again.

Powered By Swish