This happened to me after some power fluctuations in a storm caused some unexpected reboots. Here were the issues I noticed:
Nothing in my Git Repository window.
A prompt to configure my user name and email address.
"No branches" in my Git Changes window.
"Select Repository" in the bottom right corner. The repo I want to use is listed, but I can't seem to switch to it.
Here's what I tried, unsuccessfully:
I restarted VS22 (didn't help)
I restarted Windows 11 (didn't help)
I tried to open a local clone of a different project (same issues)
I tried changing Options -> Source Control -> Plug-in Selection to "None" and then back to "Git" (didn't help)
I tried updating settings in Options -> Source Control -> Git Global Settings (wouldn't retain changes)
I renamed and replaced my %userprofile%\.gitconfig file (didn't help)
In the end, the issue was that my C:\Program Files\Git\etc\gitconfig file was corrupt. It wasn't empty, but when I opened it with notepad, I just saw lots of blank spaces. I replaced it with a copy of the file that I got from a coworker, and that resolved all of my problems.