“git svn fetch” creates index.lock file then complains about it
I’m migrating a large subversion repository, with history, to git. I started by cloning the svn repo using ‘git svn clone’ command. This crashed while cloning, however, I resumed the migration by executing ‘git svn fetch’. The migration had been running successfully for a couple of days – occasionally it crashed and I had to delete the index.lock file as detailed here – fatal: Unable to create '/.git/index.lock': File exists. After deleting this file a couple of times it successfully continued until I ran into the same error:
fatal: Unable to create '/path/index.lock': File exists. If no other git process is currently running, this probably means a git process crashed in this repository earlier. Make sure no other git process is running and remove the file manually to continue. read-tree f49b2a08d26076d9cb2828b9aba5fde30d46f73b: command returned error: 128
However, this time deleting the index.lock file did not work and ‘git svn fetch’ continues to complain. Here is what is happening:
- How to permanently prevent specific part of a file from being committed in git?
- Can I copy a Git working copy onto another machine?
- Best Practice for following Subversion repository Trunk: Git (Mirror), Git-Svn, Subversion?
- Can I share the same eclipse project on a SVN & a GIT repository simultaneously?
- How to set Subversion properties with git-svn
- What does this svn2git error mean?
I get the above error
I delete the index.lock file
I restart ‘git svn fetch’
‘git svn fetch’ process recreates the index.lock file
‘git svn fetch’ errors again with the above error
So ‘git svn fetch’ appears to be in some bad loop where it’s re-creating the index.lock file then then complains about it existing. So:
I’ve deleted the index.lock file.
I’ve ensured that the machine has enough disk space.
I’ve tried rebooting the machine in case there was an old git processing hanging around that was holding on to the lock file.
I’ve done a git gc and a git prune as advised here fatal: git-write-tree: error building trees
None of the above has worked and I’m new to git. I don’t want to re-start the migration as it takes days to run. Can anyone suggest something else I could try?
One Solution collect form web for ““git svn fetch” creates index.lock file then complains about it”
Answering my own question just to tidy this up. Unfortunately I never got to the bottom of this problem and we had to set off a new migration (in fact we set off 3 migrations on different machines and the first one to finish took 2 weeks to run). If you’re migrating a large repository (ours is a code and assets base of around 35 GB) expect it to take a long time and to encounter some frustrations. We frequently encountered the error above and I’m happy to say that deleting the index.lock file and continuing the migration with “git svn fetch” worked. We didn’t again run into the problem above where the migration wouldn’t continue.