Ray's Knowledge Base
Unlock

git filter-repo removes origin and the upstream, and drops commit signatures

PitfallVerified 2 Oct 2026Holds anywhere
Pitfall. The symptom, what causes it, and the fix that was run and seen to work.

Symptom#

After git filter-repo, git rev-list origin/trunk...trunk fails with "fatal: ambiguous argument ... unknown revision", and commits are no longer signed.

Cause#

git filter-repo removes the origin remote and the branch upstream, and rewrites every hash, which drops signatures.

Fix#

Save git remote get-url origin before the rewrite, then run git remote add origin <url>, git fetch origin and git branch -u origin/trunk trunk. Re-sign with git rebase --root --gpg-sign --force-rebase. The push needs git push --force-with-lease. GitHub keeps the old objects fetchable by hash until its garbage collection runs.

Evidence#

Seen while rewriting a repository's history; the remote and signatures were restored this way.

Also found by searching

  • git filter-repo removes the origin remote and the branch upstream
  • fatal: ambiguous argument ... unknown revision after filter-repo
  • filter-repo drops commit signatures re-sign with rebase --root --gpg-sign
  • push after filter-repo needs --force-with-lease