gitコマンドを実行しようとしたところエラーが生じたので、その解決策を記します
環境: Mac OS
エラー内容
xcrun: error: invalid active developer path
解決策
以下のコマンドでコマンドライン開発者ツールをインストールします
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
インストールは初めは数時間かかると表示されますが、数分で完了します
インストールが完了したら、再実行します
$ git init