Saturday, February 14, 2026

GitHub hide and change mail in project repository files

git config --global user.name "USER"

git config --global user.email "123456789+USER@users.noreply.github.com"


git config --global --list

git config --local --list


Make sure working tree is clean:

git status


git add .

git commit -m "commit comment"


git filter-branch --env-filter '

export GIT_AUTHOR_EMAIL="123456789+USER@users.noreply.github.com"

export GIT_COMMITTER_EMAIL="123456789+USER@users.noreply.github.com"

' -- --all


rm -rf .git/refs/original

git reflog expire --expire=now --all

git gc --prune=now --aggressive


git log --reverse --format="%h %an <%ae>"

If you see:

yourname@users.noreply.github.com


git filter-branch --env-filter '

export GIT_AUTHOR_EMAIL="1123456789+USER@users.noreply.github.com"

export GIT_COMMITTER_EMAIL="123456789+USER@users.noreply.github.com"

' -- --all


git log


⚠️ This replaces the online repo history:

git push --force --all

git push --force --tags


git log


git log --all --author="yourname"

git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d

git stash clear

git reflog expire --expire=now --all

git gc --prune=now --aggressive


What others must do (if anyone cloned). They must reclone, or:

git fetch --all

git reset --hard origin/main


git log --all --author="yourname"

SHOULD SHOW NOTHING

No comments:

Post a Comment