Reset Git Username and Email

Isshiki🐈
1 min readSep 15, 2020

--

I have a dozen GitHub private repositories (my homework and some silly experiments) and many of them use usernames and email addresses I no longer use, so I want to reset them to what I am currently using (so that I can unlink these email addresses). Here basically I just do what this dev.to post tells me to do and adds a few more commands to save some jumping and typing.

# tell your shell the address of the repository you want to edit
$ export url="<repo_url>"
# your shell will download it, edit it, (force) push it,
# brings you back where you were and delete the local copy
# and then you can repeat
$ git clone $url repo; cd bin; git filter-branch -f --env-filter "GIT_AUTHOR_NAME='<new_name>'; GIT_AUTHOR_EMAIL='<new_email_address>'; GIT_COMMITTER_NAME='<new_name>'; GIT_COMMITTER_EMAIL='<new_email_address>';" HEAD; git push --force; cd ..; rm -rf repo;

--

--