After upgrade to Big Sur git stopped working

After upgrade to Big Sur git stopped working and it keeps prompting to install CLT. According to Xcode-select, see output below CLT is already installed:

sbezverk@sbezverk-mac-2 ~ % sudo xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

sbezverk@sbezverk-mac-2 ~ % git

sh: line 1:   772 Bus error: 10           /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx -find git 2> /dev/null

git: error: sh -c '/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk macosx -find git 2> /dev/null' failed with exit code 35328: (null) (errno=No such file or directory)

xcode-select: Failed to locate 'git', requesting installation of command line developer tools.

Any help to solve this issue would be great.
I was having the same issue.
I managed to get it fixed by running

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


56
Thanks! I had the same problem and it solved the problem.
Thanks mclngl !
Same here. However, got another error when run the xcode-select

Code Block
MBP$ sudo xcode-select -switch /Library/Developer/CommandLineTools
xcode-select: error: invalid developer directory '/Library/Developer/CommandLineTools'


Do I need to reinstall the xcode after upgrade to Big Sur?


Thanks @mcingi and I think I think it is better to up vote the correct answer as this makes it easy for other people to find.
For those experiencing problem after running

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

Try downloading the Xcode command line tools from -> Apple Developers Command line tools and repeat the xcode-select command above. All the best !

Hit the same issue, needed to upgrade the command line tools version prior to running the xcode-select command.
All worked fine afterwards.
I am having the same issue over and over again...
I will solve the "Git not found" error with @mcingi and @juniorme answers then it will work fine until one day Git is missing again...
Am I the only one who is having this problem repeatedly? This is the 3rd time it went missing on my MacBook Pro.
git and command line tools disappear every time I update Big Sur. Very annoying! And running

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

results in error.
Me too on three different machines - every time I update Big Sur it requires a reinstall.
Yeah it borked itself right before a lecture this time - just goes totally missing whenever I update the OS

every time I update Big Sur it requires a reinstall

Well, that’s annoying. Did you file a bug about that? If so, what’s the bug number?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"
I get this too on BigSur - so annoying, I recently switched to MAC from Windows and I'm really dissapointed on the number of bugs I hit. I get random restarts(aka blue screen) every couple of days, so many features just don't work it's unbelievable.
Happened again after update to 11.2.3.
Happens every time I update big sur as well. And yes, it happened with 12.2.3
Same. Happens every time I update the OS. Major pain.
After upgrade to Big Sur git stopped working
 
 
Q