Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git-svn

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.

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

I have tried variants with combinations of -s, -t Trunk, -t COAWST, --preserve-empty-dirs (which I would like to do), --no-meta-data (per Pro Git)...always the same final error.

Thanks for any suggestions!

like image 364
Chris Sherwood Avatar asked Jul 27 '12 18:07

Chris Sherwood


2 Answers

Every time this happened to me Git simply couldn't fetch a commit from trunk in Subversion:

fatal: refs/remotes/trunk: not a valid SHA1

Reasons:

  • You didn't specify Subversion layout when it was not standard (trunk-tags-branches). Specifically for the error - you have no /trunk.
  • You didn't fetch from revision old enough to span at least one commit into trunk (for example, using -r option).
  • Combination of the above.
like image 114
uvsmtid Avatar answered Sep 29 '22 20:09

uvsmtid


I think that you run the correct command. Alternatively you could run

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

git-svn nearly finishes its work in each case. The only thing it tries to do is to set 'master' to point to your trunk. Because of some bug it tries to set it to the wrong value but you can perform it manually with

$ git update-ref refs/heads/master refs/remotes/git-svn

If you will still have problems you may try to convert the repository with SubGit in 3 steps:

$ 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

The converted repository will be at path/to/svn/repository/conf/.git

like image 44
Dmitry Pavlenko Avatar answered Sep 29 '22 21:09

Dmitry Pavlenko