Reputation: 407
I've noticed that all my githubs commits would appear with my name, but not associetad with my account. The same problem as this: Git commits are not getting linked with my GitHub account
I followed those steps and fixed that problem. However, the old commits are still not linked to my account. Since this was for over 1 year, i would really need for them to be linked (nowadays the github profile is very important and mine looks empty, like i've not worked that year ...)
Is there any command to associate every commit from every repository i've made in that time?
Thanks for your time
Upvotes: 1
Views: 3305
Reputation: 407
Okay, sorry for the delay, but since I eventually figured this out, through mail exchange with git staff (and found it quite useful) I will share how to fix this!
So, if for some reason the git settings you were committing with were off and you can't see your commits in your profile and in the repos they are not linked to your account, this is how to do it (I will assume at this point, that you have fixed your configs in your terminal, so future commits will be correctly linked, if not just follow this tutorial ).
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="email you just saw in .patch"
CORRECT_NAME=“correct username, you can check it in your terminal git config --global user.name”
CORRECT_EMAIL=“correct email, you can check it with git config --global user.email”
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_COMMITTER_NAME="$CORRECT_NAME"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
export GIT_AUTHOR_NAME="$CORRECT_NAME"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags
Hope it helps, this fixes every commit you made with the wrong email in one repo, so if you've this trouble in multiples, you will have to do it once in every single one (and one time for each different wrong email you've committed with). Any doubt just ask :)
Upvotes: 5
Reputation: 6532
You must make sure that the email associated with your commit is the same as the one one your Github profile.
To check the email address currently associated with your git
commits:
git config --global user.email
To modify the email address associated with your git
commits:
git config --global user.email "[email protected]"
Note that changing your email address will not change the email associated with your old commits. You could instead add the old email address to your Github profile as well.
Upvotes: 2