the wiki of cscosine
⚠️ WARNING: This rewrites commit history. All commit SHAs will change. Force push is required.
git clone --mirror git@github.com:USER/REPO.git
cd REPO.git
Note: a mirror is a full repo copy. It will clone in REPO.git folder.
Install:
pip install git-filter-repo
Run:
git filter-repo \
--name-callback 'return b"Your Name"' \
--email-callback 'return b"your.email@email.com"' \
--commit-callback '
commit.gpgsig = None
'
This rewrites:
Check metadata:
git log --all --pretty=format:"%an %ae | %cn %ce"
Search for unwanted strings:
git log --all --grep=OLD_STRING -i
git grep -i OLD_STRING $(git rev-list --all)
Check signatures:
git log --show-signature
This should not have any gpg: ... line.
Re-add origin with:
note: see also Multi-Account GitHub SSH Setup (Clean and Safe) if you want to setup properly multiple accounts on the same machine
git remote add origin git@github.com:USER/REPO.git
or
git remote add origin https://github.com/USER/REPO.git
and then
git push --force --all
git push --force --tags
For maximum cleanup:
This removes:
After this procedure: