I have recently made a new github account and when I tried to push some files through git terminal into repository of my new account. it tells that I don't have access to the new account. So, I deleted the old credential of my previous account manually and saved the new one through git terminal. Now, it pushes the files into the repository of my new account with my old account (like as a contributor). So, I again deleted the credential of my new account manually from my pc and the git terminal show
The authenticity of host 'github.com (20.207.73.82)' can't be established.
ED***** key fingerprint is SHA256:**some SHA256 code**.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])?
I even tried re-installing git terminal but it's still the same
note: the question is a bit fuzzy, I think the OP has an issue with credentials vs author. This is an answer to the question :
"I changed my github credentials, why are my contributions still linked to my old account ?"
There are two notions of "credentials", that are completely separate:
git log
in your terminal for example -- you generally set it using git config user.name
and git config user.email
You need 1. in order to do some actions on github: push to a repository, read from a private repository, etc ...
But 1. does not impact or modify 2. : you could perfectly be pushing commits written by Alice, and Alice could perfectly be pushing commits authored by you.
So even if you changed your credentials with github (that's 1.), your repo's history still mentions the same authors and committers (that's 2.). The information that github scans to say what counts as a contribution is 2., the email stored in the history of your repository.
git config user.name "updated name"
git config user.email "updated@email.com"
# if you want to apply this to all projects on your computer
# (at least: all the ones that do not have a local user.email config)
git config --global user.name "updated name"
git config --global user.email "updated@email.com"
# to check, within a repository, what email is used:
git config user.email
git config --show-origin user.email
in github GUI, go to your profile section and add that other email.
You may also need, if relevant, to delete your previous account.
quoting the accepted answer to the question "How do I change the author and committer name/email for multiple commits?":
using git filter-repo, you can first install it and construct a
git-mailmap
according to the format of gitmailmap.Proper Name <proper@email.xx> Commit Name <commit@email.xx>
And then run filter-repo with the created mailmap:
git filter-repo --mailmap git-mailmap
(note: the answer initially provided a working solution with git filter-branch
, and then added an update when the git filter-repo
tool was available. I am merely highlighting this part of the answer as it is IMHO, to this day, the most suitable way to do this)