2

I have a local git repository with a bunch of commits made with my real name and personal email. I want to push these to GitHub, but without using my personal details.

I've rewritten the name and email for each commit using the following command:

git filter-branch -f --env-filter \ "GIT_AUTHOR_NAME='github_username'; GIT_AUTHOR_EMAIL='[email protected]'; \ GIT_COMMITTER_NAME='github_username'; GIT_COMMITTER_EMAIL='[email protected]';" HEAD 

All looks fine when a do a git log after this. My personal email is nowhere to be seen.

I then try to GPG sign every commit using:

git filter-branch --commit-filter 'git commit-tree -S "$@";' -- --all 

But on the very first commit I get the following error:

Rewrite 1124486cba6a6f6432adb24f7c66833d860b191f (1/38) (1 seconds passed, remaining 37 predicted) gpg: skipped "My Real Name <[email protected]>": No secret key gpg: signing failed: No secret key error: gpg failed to sign the data could not write rewritten commit 

Where is it getting my old username and password from?

1 Answer 1

1

Turns out the -- --all at the end was the culprit. Changing that to HEAD instead worked fine.

git filter-branch --commit-filter 'git commit-tree -S "$@";' HEAD 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.