git is lost after upgrading Mac OS

I realized my git was not working when I executed `git status. It was all of a sudden to me because I did nothing, and I was in the middle of an important job. I have to complain about this to Apple.

I got this popup message "The "git" command requires the command line developer tools...". And when I successfully installed the Command Line Developer Tools again, it won't resolve this problem. The popup message will pop up again and again. I tried to download the "Command Line Developer Tools" from Apple's website and install it manually with no luck.

After searching online, I noticed that other people ran into this issue in the past too. That means this case happens not only on this version (Monterey) but also on previous versions.

Finally, I found this work for me.

sudo xcode-select -switch /Library/Developer/CommandLineTools