Recently, I upgraded my macOS to Mojave and ran into the following error after running the
git init command.
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
I was able to fix this by running the following command in a terminal…
Accept the license and install xcode-select when the associated install prompt window appears. You should then be back in business (at least, I was).