问题
My problem: Migration by an Ubunut VM in Windows; Windows had a blue screen of death; Windows restarted; the migration was damaged!
~/folder$ svn2git --rebase
error: refs/remotes/svn/some_branch does not point to a valid object!
fatal: git cat-file 81974ef70e6b9dba85295bf7341dd6808c03250d: bad file
cat-file commit 81974ef70e6b9dba85295bf7341dd6808c03250d: command returned error: 128
command failed:
git svn fetch
I already tried to fix my problem like mentioned in these answers:
- https://stackoverflow.com/a/802297/575643
- https://stackoverflow.com/a/12371337/575643
Unfortunately none helped me so far.
Anyone have a clue how to fix that? This migration already took +2 weeks and I don't wanna start again.
回答1:
There are pleny tools called svn2git
, the probably best one is the KDE one from https://github.com/svn-all-fast-export/svn2git. From your question I conclude that you are not using that one, but the one that is based on git-svn
. I strongly recommend using that svn2git
tool. It is the best I know available out there and it is very flexible in what you can do with its rules files.
Also the whole migration that took you more than 2 weeks already will most probably be finished in a few hours as it is blazingly fast.
If you are not 100% about the history of your repository, svneverever
from http://blog.hartwork.org/?p=763 is a great tool to investigate the history of an SVN repository when migrating it to Git.
回答2:
The first problem to solve is to ensure git-fsck
runs ok. Thereafter, the second problem is to be able to continue the migration.
It is likely the first commits of the branch were correctly written to disk but the last ones failed. Try to run git reflog show refs/remotes/svn/some_branch
. If it shows commits, try to find the last commit that is present: git show <hash>
. Then you reset the branch: git update-ref -m 'last commit found' refs/remotes/svn/some_branch <hash>
.
Then run git fsck
and fix the next branch.
git-svn
has a command git svn reset -r <n>
. svn2git
will probably have a similiar one. This will allow to restart the fetch from the last correct state.
来源:https://stackoverflow.com/questions/38770736/svn2git-object-reference-error