E-mail privacy in GitHub
Future commits
- Check both
Keep e-mail private
andBlock command-line pushes
options in your GitHub e-mail settings. - Set your GitHub private e-mail address globally of per-project:
# current project
$ git config user.email "username@users.noreply.github.com"
# global
$ git config --global user.email "username@users.noreply.github.com"
Past commits
WARNING: These steps rewrite your repository history. Read about collaboration and rewriting history.
Last commit
$ git commit --amend --reset-author
Bulk edition
-
Install
git-filter-repo
which is the officialgit filter-branch
replacement. -
Clone repo (bare or not)
$ git clone --bare https://hostname/user/repo.git
$ cd repo.git
- Update e-mail and/or name from all commits matching your
old@email.com
note the usage ofbytes
)
# update e-mail only
$ git-filter-repo --email-callback 'return email if email != b"old@email.com" else b"username@users.noreply.github.com"'
# update both e-mail and name
$ git-filter-repo --name-callback 'return b"Your Name"' --email-callback ...
- Re-add remote repository (
git-filter-repo
deletes remotes as a safety measure to avoid unintended history rewrites!)
$ git remote add origin <remote-url>
- Force push changes (!)
$ git push origin -f --all