Try below methods to solve your issue.
- Clear Cached Credentials.
- Go to Windows Credentials Manager (search "Credential Manager" in the
Windows search bar).
- Under Windows Credentials, look for any entries related to
github.com or Visual Studio, then remove them.
- Restart Visual Studio and try logging in again.
- Reconfigure GitHub Account in Visual Studio.
- Open Visual Studio 2022 and go to File > Account Settings > All
Accounts.
- If GitHub appears, try removing and re-adding the account.
- Click Add an account, select GitHub, and follow the prompts to log in.