Git svn clone with author name like “/CN=myname”

I’m trying to switch from svn to git on windows 7 using git svn clone command.

On one of my repository I try this:

  • Undo a git clean command?
  • Create git repository after project creation
  • How to maintain two versions of a project on GitHub?
  • Committing all files from Android Studio to GitHub
  • Why is git prompting me for a post-pull merge commit message?
  • git gitolite (v3) pre-receive hook for all commit messages
  • git svn clone --stdlayout --no-metadata -A users.txt --username=/CN=john https://path/to/my/repo ./

    Here is my users.txt file:

    /CN=john = John Doe <>

    When I git svn clone nothing was displayed just like if everything was ok but no file were cloned. So in C:/Users/John/.suversion/servers I’ve set neon-debug-mask = 256 to display log errors.

    My error is now displayed: Author: /CN=john not defined in users.txt file so I think since there is an equal in my username the git clone command can’t properly parse the datas.

    I’ve tried escaping /CN\=john and quoting '/CN=john' "/CN=john" but nothing seems to work.

    Does anyone have an idea for the good way to handle this?

    Thank you

  • Is it worth the effort to create pretty revision history in a DVCS?
  • How to avoid a commit/release loop with Maven and CI?
  • Git: send commit to another branch so I can work and merge back, without (very slow) checkout?
  • DVCS with a Windows central repository
  • Git - push to new remote with a single consolidated commit
  • Git command to get all folders with changes
  • 4 Solutions collect form web for “Git svn clone with author name like “/CN=myname””

    git-svn cannot currently handle SVN users which have an equals sign “=” in their usernames.

    Here is the relevant code from inside git-svn:

    # '<svn username> = real-name <email address>' mapping based on git-svnimport:
    sub load_authors {
                open my $authors, '<', $_authors or die "Can't open $_authors $!\n";
                my $log = $cmd eq 'log';
                while (<$authors>) {
                                next unless /^(.+?|\(no author\))\s*=\s*(.+?)\s*<(.+)>\s*$/;
                                my ($user, $name, $email) = ($1, $2, $3);
                                if ($log) {
                                                $Git::SVN::Log::rusers{"$name <$email>"} = $user;
                                } else {
                                                $users{$user} = [$name, $email];
                close $authors or croak $!;

    … as you can see, the regex used to extract usernames from the file will consider only text up to the first “=” as part of the SVN username. Everything after that is considered part of the git username.

    This is a bug in git-svn.

    Possible workarounds off the top of my head:

    • I think the first .+? in that regex should be greedy, and the last .+ non-greedy, i.e. next unless /^(.+|\(no author\))\s*=\s*(.+?)\s*<(.+?)>\s*$/;
      • You could submit a fix patch to the git project?
      • You could patch your local git scripts for now, and include that in your project’s setup instructions
    • You could alias the git svn command to include --authors-prog option each time, in your .bash_profile?
    • Can you get a perl script to be run before each git-svn command? If so, you could write perl code which sets $Git::SVN::Log::rusers or $users{$user} directly?

    I had a similar problem. The best workaround I found was to use the --authors-prog option to specify a script converts the svn username eg.

    $svnAuthor = $ARGV[0];
    if ($svnAuthor =~ /^.*?emailAddress=(.*?)\/CN=(.*?)\/.*$/) {
        print "$2 <$1>";
    } else {
         print $svnAuthor;


    This can be set using

    git config svn.authors-prog <authorScript>  

    I’ve finally found a solution by not using users.txt.

    First I do a git svn clone -s https://path/to/my/repo ./ which clone every files from the repository.

    Now if I do a git log I’ve got ugly name and mails for every users and I want to clean that. I’ve simply used this gist which does a git filter-branch --env-filter and search & replace authors and mails by the one you provide in the gist.

    Beware of this solution because it has to crawl each commit in your repository and you have to launch the script for each branch of your repository.

    Hope it helps!

    My solution was to (temporarily) patch git-svn’s load_authors subroutine so the regex pattern had \s=\s instead of \s*=\s*. Then, I just made sure that all the lines in my authors file had exactly one space surrounding my equals sign on each side. This worked for me, because none of the equals signs in the old usernames had spaces on both sides.

    Git Baby is a git and github fan, let's start git clone.