Xcode – Invalid active developer path error after upgrading to El Capitan

gitxcode

I ran into this error trying to push to git, when I typed git init.

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

I tried the following solutions.

xcode-select —install
sudo xcode-select -switch
sudo xcode-select —install
brew doctor
brew update
brew upgrade
brew cleanup

Best Solution

This is all you need to do:

$ xcode-select --install