Hello! I am a very rare user of GitHub, simply having a repo to move my D&D notes from desktop to laptop when it's time to play. I've been mainly working on the go, but wanted to get up to date on my new desktop. I re-downloaded git and vs code, and when attempting to get set back up, I was prompted to connect to GitHub. When I opened up my MS authenticator app, my GitHub account was missing. Attempts to recover the account have hit dead ends.
I am still able to use vs code on my laptop to push/pull from the existing repo, but I don't seem to have any way to sign into the account directly to link the desktop. The account recovery option for 'verify this device' is greyed out when using the laptop. I assumed that, since the laptop using vs code can utilize the repo, it would somehow be a verified device. I don't know what the verified device requirements are. I have access to the email account linked to the GitHub account. I didn't know anything about SSH keys or personal access tokens, so they were never set up. And I can't find any record of the recovery codes GitHub promises they sent me.
Do I have any options to log back into the GitHub account? It is likely not a big deal to unlink the email address and GitHub account, since I have my local repo on my laptop and can push it to a new account/repo. I just wanted that to be a last resort. If I have to set up a new GitHub account, is there any way to reuse the account name?
You don't login to Git.
You do login to a Git repository hosting server, which requests an authentication, but Git itself has no authentication nor authorization.
(As an example of a Git repository hosting service offering login:
- GitHub:
gh auth login - GitLab:
glab auth login)
What Git does have is credential caching (check the output of git config credential helper)
On Mac: "Updating credentials from the OSX Keychain": you can check if your old user was stored there, and update it.
If you really want to disable the credential helper, you will be asked your credentials every time you push to a repository hosted on a server requesting authentication.
Regarding AgilePro's answer:
Again, there is no way to ask git to log in, instead you have to make a bogus change and then try to push the change to get it to prompt you to log in.
Not true.
Git itself does not log you in, as mentioned in my answer above.
A third-party CLI tool (like GitHub CLI gh) can connect to a repository hosting service (like github.com) and trigger the authentication.
No repository needed.
With GitHub: create first through the Web UI a Personal access tokens (classic), with minimum required scopes: repo, read:org, and gist.
Its token prefix will be ghp_....
Then authenticate yourself from the command-line, after installing gh, using gh auth login
gh auth login
You can enter your GitHub user account name, and your token.
Then, a gh auth status would give you:
C:\Users\vonc\git>gh auth status
github.com
✓ Logged in to github.com as VonC (C:\Users\vonc\AppData\Roaming\GitHub CLI\hosts.yml)
✓ Git operations for github.com configured to use https protocol.
✓ Token: ghp_************************************
✓ Token scopes: admin:org, gist, repo, user, workflow
You are authenticated (to GitHub, not to "Git").
You can also register your token with the local credential manager:
git config --global credential.helper manager
printf "protocol=https\nhost=github.com\nusername=<me>\npassword=<my_token>" |\
git-credential-manager store
This is purely for safekeeping, and does not authenticate you.
I had a similar problem with Windows. Updating Credentials Manager helped in my case.
To open Credentials Manager search that setting or navigate to:
Control Panel\All Control Panel Items\Credential Manager. In Windows Credentials -> Generic Credentials find your repo and update username/password or delete all that are not needed.