git-svn迁移致命:不是有效的SHA1 update-ref refs/heads/master refs/remotes/trunk:command返回错误:128

Chr*_*ood 16 git-svn

尝试将大型但线性的svn存储库迁移到git.svn存储库没有标准布局(主干,分支,标签)......只有一个带有主干的目录.

Ubuntu 12.4 LTS,git 1.7.9.5.

$ git svn clone https://coawstmodel.sourcerepo.com/coawstmodel/COAWST --authors-file=../users.txt COAWST

...

    D   WPS/metgrid/storage_module.F
    D   WPS/metgrid/process_domain_module.F
W: -empty_dir: WPS/metgrid/gridinfo_module.F
W: -empty_dir: WPS/metgrid/input_module.F
W: -empty_dir: WPS/metgrid/interp_option_module.F
W: -empty_dir: WPS/metgrid/module_date_pack.F
W: -empty_dir: WPS/metgrid/process_domain_module.F
W: -empty_dir: WPS/metgrid/storage_module.F
r635 = c19181c9718e701788b540ed0cc559e4fbddf413 (refs/remotes/git-svn)
    M   Tools/Docs/COAWST_User_Manual.doc
r636 = 1b7849c3e5a20856c9ddb909a5f53ddf8501ad33 (refs/remotes/git-svn)
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 14143, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14039/14039), done.
Writing objects: 100% (14143/14143), done.
Total 14143 (delta 8350), reused 0 (delta 0)
fatal: refs/remotes/trunk: not a valid SHA1
update-ref refs/heads/master refs/remotes/trunk: command returned error: 128
Run Code Online (Sandbox Code Playgroud)

我尝试过使用-s,-t Trunk,-t COAWST, - preserve-empty-dirs(我想做的)组合的变体, - no-meta-data(每个Pro Git)...总是同样的最终错误.

谢谢你的任何建议!

uvs*_*tid 12

每次发生这种情况时,Git根本无法从trunkSubversion中获取提交:

fatal: refs/remotes/trunk: not a valid SHA1
Run Code Online (Sandbox Code Playgroud)

原因:

  • 当它不是标准(trunk-tags-branches)时,您没有指定Subversion布局.特别是对于错误 - 你没有/trunk.
  • 您没有从足够大的修订版中获取至少一个提交到trunk的提交(例如,使用-r选项).
  • 以上的组合.

  • +1:我尝试使用`-r`选项获取并发生错误.当我获取所有修订版时,问题就消失了. (2认同)

Dmi*_*nko 10

我认为你运行正确的命令.或者你可以跑

$ git svn clone https://coawstmodel.sourcerepo.com/coawstmodel --trunk=COAWST --authors-file=../users.txt COAWST
Run Code Online (Sandbox Code Playgroud)

git-svn几乎完成了每个案例的工作.它唯一要做的就是将'master'设置为指向你的主干.由于某些错误,它会尝试将其设置为错误的值,但您可以手动执行它

$ git update-ref refs/heads/master refs/remotes/git-svn
Run Code Online (Sandbox Code Playgroud)

如果您仍然遇到问题,可以尝试使用SubGit转换存储库, 3个步骤:

$ subgit configure path/to/svn/repository
#edit path/to/svn/repository/conf/subgit.conf to set trunk = COAWST:refs/heads/master and authorsFile = path/to/users.txt
$ subgit install path/to/svn/repository
Run Code Online (Sandbox Code Playgroud)

转换后的存储库位于path/to/svn/repository/conf/.git