How to switch svn repositories using git-svn?

后端 未结 2 1833
醉话见心
醉话见心 2021-02-07 01:25

I have a number of git projects created as clones of SVN repositories using git-svn. We have migrated our SVN repositories to a new provider so the URL has now changed. How can

2条回答
  •  广开言路
    2021-02-07 01:53

    Following the same url [1], but with an updated solution, it becomes much easier.

    Inside .git/config, in the [svn-remote] section, set url to the new URL, and set rewriteRoot to the old URL:

    [svn-remote "svn"]
        url         = https://new.svn-server.net/svn/root
        rewriteRoot = https://old.svn-server.net/svn/root
    

    The same can be surely done via the git config ... commands from the guide:

    $ git config --local --replace-all svn-remote..rewriteRoot `git config --local --get svn-remote..url`
    $ git config --local --replace-all svn-remote..url 
    

    Then it just works, for me I don't have to make any dummy revision even though there's no new revisions on the new server. Interestingly, git svn info reports the same old URL, but with the new URL as Repository Root:

    $ git svn info
    Path: .
    URL: 
    Repository Root: 
    

    [1] https://git.wiki.kernel.org/index.php/GitSvnSwitch

提交回复
热议问题