user56834
user56834

Reputation: 394

github auto authentication with personal access tokens doesn't work

I have followed the explanation here for setting up auto authentication of github on my CLI (on Linux, Ubuntu). In particular, I executed the command given here:

gh auth login

And then I answered Github.com, yes, HTTPS, and my authentication token to the prompts.

This seems to work: It states "Configured git protocol" and "Logged in as ...".

However, when I then write git clone <myrepo>, it asks me again for my username and password.

What am I doing wrong? My understanding was that the gh aut login command is supposed to prevent me from having to type the login data each time.

Upvotes: 6

Views: 4830

Answers (2)

synthmusic
synthmusic

Reputation: 321

found in the Github CLI Docs:

after you run gh auth login then run this command

gh auth setup-git

Upvotes: 15

Marc
Marc

Reputation: 81

In my case it was solved by adding at the end of the file ~/.gitconfig the following:

[credential "https://github.com"]
    helper = 
    helper = !/snap/bin/gh auth git-credential

Modify /snap/bin/gh with your real path (I've seen others having it in /usr/bin/gh)

Upvotes: 8

Related Questions