git svn importing a branch with a trailing space

I’m importing a svn repository into git using git svn. I’m using Git-1.8.0-preview20121022 on Windows Server 2008 R2.

The import’s been running for a while and has fetched the first 4000 revisions without incident. However, it now seems to have come across a branch name with a trailing space and it has fallen over.

  • Import a Python library from Github
  • how to remove a file from github and stop being tracked?
  • remove a file with dashes from git
  • Switch a branch and preserve current branch changes in Git
  • GIT - who pushed/wrote most code
  • Why hudson/jenkins tries to make commit?
  • $ git svn fetch
    Found possible branch point: https://10.10.10.2/svn/project/trunk => https://10.10.10.2/svn/project/branches/Release%2020110929%20, 3976
    Found branch parent: (refs/remotes/Release 20110929 ) 691fb7f7d11cbb1afe35106f60a1d117ba415f4c
    fatal: Unable to create 'd:/GitMigration/project/.git/svn/refs/remotes/Release 20110929 /index.lock': No such file or directory
    read-tree 691fb7f7d11cbb1afe35106f60a1d117ba415f4c: command returned error: 128
    

    This branch doesn’t exist any more so I can’t change the name in the normal way. The directory exists without the trailing space in the name but I can’t find a way to rename it that preserves the space.

    Is there anything I can do about this?

  • updated local but unable to push
  • How to add an enterprise certificate authority (CA) to git on cygwin (and some linux distros)
  • Git configuration to pull/push WITH password
  • Working with git behind proxy
  • Smartest way to grab a file from GitHub via REST API or Ocktokit (Ruby)
  • Difference between `git submodule init && git submodule update` and `git submodule update --init`?
  • 3 Solutions collect form web for “git svn importing a branch with a trailing space”

    The root cause of the issue – GIT creates a directory with a trailing space but in fact its name is truncated. For example Windows mkdir likes to do that. GIT doesn’t expect that and continues to use name with a space and fails to find a dir.

    It can be fixed manually. Use FAR, GnuWin or any other tool which can make a directory with a trailing space. Then rename “d:/GitMigration/project/.git/svn/refs/remotes/Release 20110929” to “d:/GitMigration/project/.git/svn/refs/remotes/Release 20110929”. As you can see that’s the directory GIT was expecting to find.

    Then run git svn fetch again.

    In the end I gave up on importing this in Windows. There are hacky solutions out there I’m sure, but it’s much easier just to do this in Linux then pull it from there to Windows. This should work fine as long as the branch isn’t current.

    There is a manual workaround this issue. Try creating the the DIR manually.
    To avoid trimming of white trailing white space you can add “\?\ at the beginning of the path” in cmd command. e.g.

    mkdir "\\?\d:\GitMigration\project\.git\svn\refs\remotes\Release 20110929 "
    
    Git Baby is a git and github fan, let's start git clone.