Home > Blockchain >  Using git credentialmanager with github tokens for gists
Using git credentialmanager with github tokens for gists

Time:12-19

I'm trying to push my gist to github and trying to do it the right way by using the credential manager as per this answer

I assumed following simple workflow would suffice

  • clone a gist
  • pushing would ask credentials (username/token)

Unfortunately, it's either not that simple or I messed up somewhere else. All I get is a remote: Repository not found.


Cloning my gist

C:\Users\lieve\AppData\Local\Temp>git clone https://gist.github.com/lkeersmaekers/4884d047b3b90ccd697a4d7ec21be49d
Cloning into '4884d047b3b90ccd697a4d7ec21be49d'...
remote: Enumerating objects: 9, done.
remote: Total 9 (delta 0), reused 0 (delta 0), pack-reused 9
Receiving objects: 100% (9/9), done.
Resolving deltas: 100% (2/2), done.

Show remotes

C:\Users\lieve\AppData\Local\Temp>cd 4884d047b3b90ccd697a4d7ec21be49d
C:\Users\lieve\AppData\Local\Temp\4884d047b3b90ccd697a4d7ec21be49d>git remote -v
origin  https://gist.github.com/lkeersmaekers/4884d047b3b90ccd697a4d7ec21be49d (fetch)
origin  https://gist.github.com/lkeersmaekers/4884d047b3b90ccd697a4d7ec21be49d (push)

Try to push fails and doesn't ask any credential

C:\Users\lieve\AppData\Local\Temp\4884d047b3b90ccd697a4d7ec21be49d>git push
remote: Repository not found.
fatal: repository 'https://gist.github.com/lkeersmaekers/4884d047b3b90ccd697a4d7ec21be49d/' not found

Credential manager diagnosis C:\Users\lieve\AppData\Local\Temp\4884d047b3b90ccd697a4d7ec21be49d>git credential-manager-core diagnose Running diagnostics...

 [ OK ] Environment
 [ OK ] File system
 [ OK ] Networking
 [ OK ] Git
 [ OK ] Credential storage
 [ OK ] Microsoft authentication (AAD/MSA)
 [ OK ] GitHub API

Diagnostic summary: 7 passed, 0 skipped, 0 failed.

I can get push to work by changing the remote to https://<token>@gist.github.com/lkeersmaekers/4884d047b3b90ccd697a4d7ec21be49d but that's exactly what the credential manager should take care of?

CodePudding user response:

The Git Credential Manager (GCM) (previously GCM-core, recently renamed as GCM) depends on the Windows Credential Manager.

Open said Windows Credential Manager and check if there is any github.com entry, which might include the wrong password (like your actual password instead of a token).

Delete that entry, and the next git push would ask for your credentials (do use the token as password then).

  • Related