VS Code has a builtin extension GitHub Authentication
that manages creation of a GitHub Personal Access Token and automatic logins.
However, if you are using more then one GitHub account, the extension might try generating a PAT for the wrong account, resulting in an access denied.
Logon failed, use ctrl+c to cancel basic credential prompt.
remote: Permission to MyAccount/repo.git denied to OtherAccount.
fatal: unable to access 'https://github.com/MyAccount/repo.git/': Failure when receiving data from the peer
The remedy is to abort the web session started by GitHub Authentication
, and then in the message bar of VSCode, click on GitHub Authentication
to trigger the manual failback PAT handling.
First make sure you have a current PAT created for repo access for MyAccount on GitHub. Then copy the PAT and enter it VSCode when prompted.