Home > database >  github cli authentication doesn't get my real user
github cli authentication doesn't get my real user

Time:08-20

everytime I try to push to a repo I am asked for my account, username and token. so I searched for solutions and found that if you install the github cli app I could authenticate one time and it will not ask me when I try to push again. so I did that for a while but then I discovered that when I went to my profile's contribution chart, the numbers was awfully off. I went to my commits and found this look:

enter image description here

as you can see some commits has my picture and some doesn't, which clearly meant that I was pushing with a user that wasn't linked to my github user, but had the same name. the commits that has my image are the ones I edited directly in github the website.

so my questions are:

  1. why does the gh cli doesn't link my github account properly
  2. how can I authenticate in a better way without having to re-enter my username and my token
    • the token method is kinda less secure because I am required to save my token in a place to copy paste it and having stuff in the clipboard isn't really the safest thing (even if I'm doing the < token.txt thing, I still have to store it somewhere visible). using a password is much more safe since it's stored in my brain and I can type it without copy pasting. so the whole token thing is not practical.

here is the commit page from the repo that I was working on

CodePudding user response:

GitHub authentication is not used for GitHub's contributions count.

Your email address, as it appears in each commit, is used; see the GitHub documentation. Note that the user.email setting used when creating commits has nothing to do with authentication. You set this in Git independently of whether and how you authenticate to GitHub.

Once you make any particular commit, that commit has that email address. It cannot be changed. If you used the wrong email address, you may wish to replace that commit with a different commit that contains the correct email address.

  • Related