git-svn migration fatal: not a valid SHA1 update-ref refs/heads/master refs/remotes/trunk: command returned error: 128

后端 未结 5 752
醉话见心
醉话见心 2021-02-07 09:20

Trying to migrate a large but linear svn repository to git. The svn repository does not have the standard layout (trunk, branches, tags)...just one directory with the trunk.

5条回答
  •  面向向阳花
    2021-02-07 09:41

    I had the same problem today.

    The problem is probably that the SVN repository does not have a trunk directory. The standard trunk, tags and branches directories seems to be optional in SVN. But git-svn needs to know about this when migrating.

    It is also possible that some of the directories are there but named differently. (for example trunk could be named "project" instead of "trunk", branches could be named "branches" as usual and tags could be missing. Or "trunk" could be named "Trunk".)

    • If there are none of these standard directories in the SVN repo, and everything is just placed in the root of the repo, the solution is simply to not to try clone the standard svn-directories. Just clone the root.

    • If they exists (or some of them does), but under different names, git-svn has to be told about these names.

    I used Tortoise Git to migrate from SVN to GIT. In TortoiseGit, it is done by cloning from the svn repository (yep!) and checking the "From SVN Repository" checkbox.

    • If there are no trunk, tags or branches directories in the SVN repo, simply uncheck the "trunk", "tags" and "branches" checkboxes in the "From SVN Repository" section of the clone dialog.

    • If the standard directories are there, but are named differently than normal, keep them checked but write the used names in the textbox next to them.

      (From the commandline this can be done with the -T, -t and -b switches. See http://www.sailmaker.co.uk/blog/2013/05/05/migrating-from-svn-to-git-preserving-branches-and-tags-3/ under "non-standard SVN layout").

    (Those were the two cases i encountered - more complex cases may exist. I had several SVN repositories with neither trunk, tags or branches directories and unchecking these 3 checkboxes made it work. I also had a case where the trunk dir was called "project" instead of "trunk", but the branches dir was named normally and there were no tags dir. Unchecking the tags checkbox and entering the name of the trunk directory made that case work.)

提交回复
热议问题