'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.



Solution 1:[1]

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)

Solution 2:[2]

found in the Github CLI Docs:

after you run gh auth login then run this command

gh auth setup-git

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marc
Solution 2 synthmusic