Search code examples
gitsvnversion-controlgit-svn

SVN-Git migration: clean-git branch error


I'm following the SVN to Git migration guide, the git svn clone goes fine but when I run the cleanup command I get this error, I'm not even sure what this means. How do I solve this ?

java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git
Could not retrieve the config for the key: svn-remote.svn.branches

Solution

  • This problem comes up when you are not specifying the --branches while running the git svn clone command. You can avoid it by specifying the --branches while executing the git svn clone as follows:

    git svn clone --username=ArpitAggarwal --branches=/dev --authors-file=C:/Users/ArpitAggarwal/authors.txt http://localhost:81/svn/project/branches/ dev-git
    

    Still if you don't want to specify --branches, a workaround is to add an empty "branches" key in .git/config, as follows:

    [core]
        repositoryformatversion = 0
        filemode = false
        bare = false
        logallrefupdates = true
        symlinks = false
        ignorecase = true
        hideDotFiles = dotGitOnly
    [svn-remote "svn"]
        url = http://localhost:81/svn/project/branches
        branches = 
    [svn]
        authorsfile = C:/Users/ArpitAggarwal/authors.txt
    

    For similar error with tags:

    Could not retrieve the config for the key: svn-remote.svn.tags

    add an empty "tags" key in .git/config, as follows:

    [core]
            repositoryformatversion = 0
            filemode = false
            bare = false
            logallrefupdates = true
            symlinks = false
            ignorecase = true
            hideDotFiles = dotGitOnly
        [svn-remote "svn"]
            url = http://localhost:81/svn/project/branches
            branches = dev/*:refs/remotes/origin/*
            tags =  
        [svn]
            authorsfile = C:/Users/ArpitAggarwal/authors.txt