invalid author/committer line - missing space before email

git, git-filter-branch, git-rewrite-history

Solution

The solution to my question came from a friend that asked me to write the answer on his behalf:

Filter the repo, changing the bogus author with the following. Note that this should be on two separate lines (normally using shift+enter):

$ git filter-branch --commit-filter 'case "$GIT_AUTHOR_NAME" in
> *author\<\ email*) GIT_AUTHOR_NAME=author_name; GIT_AUTHOR_EMAIL=author_email;; esac; git commit-tree "$@" '

Since the faulty commits are still in the repository, `git fsck` will still fail on them. To get rid of those commits, clone the repo and then prune unused objects:

$ git clone badrepo goodrepo && cd goodrepo
$ git gc --prune=all

The new repository is clean. `git fsck` returns no errors.

Problem

I have a git repository that was cloned from a bzr repository using git-remote-bzr as follows: `git clone bzr::/repo new-repo`. After a few hundreds of commits, I executed `git fsck` and I got the following error for all the bzr commits: error in commit 41bf5: invalid author/committer line - missing space before email When I check these revisions with `git cat-file -p 41bf5` I can indeed see that the author name and the email are not separated with a space. How can I add this missing space for all the bad commits ? I have full access to the repo on the server so I can rewrite the history without any problems. After modifications the users of the code will have to reclone the repository. I already tried without success the solutions proposed in the following posts: - How do I change the author of a commit in git? - Change commit author at one specific commit

Original source

Related problems