About 2nd part of your question: there's git filter-branch
command that lets you rewrite Git history. Usage:
git filter-branch --env-filter '
oldname="(old name)"
oldemail="(old email)"
newname="(new name)"
newemail="(new email)"
[ "$GIT_AUTHOR_EMAIL" = "$oldemail" ] && GIT_AUTHOR_EMAIL="$newemail"
[ "$GIT_COMMITTER_EMAIL" = "$oldemail" ] && GIT_COMMITTER_EMAIL="$newemail"
[ "$GIT_AUTHOR_NAME" = "$oldname" ] && GIT_AUTHOR_NAME="$newname"
[ "$GIT_COMMITTER_NAME" = "$oldname" ] && GIT_COMMITTER_NAME="$newname"
' HEAD
For more information please check git docs, or this dedicated article on github.
Although it can be real pain if you have many existing users identified as "unknown".
And about first part I would:
- Check
user.name
and user.email
in git config. These have nothing
to do with credentials, but git uses them to store authorship
information. It's possible that you need to set them up (as global
with git config --global
to use for every repository, or as
repository-based with git config
).
- Check if git doesn't use any credential helpers to avoid repetition. (
git config -l
), if it does - remove it (I believe git config --global --unset credential.helper
but I'm sure).
You may want to check this or this answers.