how to convert svn repository to git on Windows

前端 未结 4 1296
陌清茗
陌清茗 2021-02-09 18:17

We have remote svn repository and we want it to convert to git. Could you please tell me how is it possible to do it on Windows? Thank.

4条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-09 19:01

    Context: Remote svn server with HUGE repository of several projects. However I only wanted to migrate one project from SVN to Git

    Here's how I did it:

    Requirements:

    1. Git Extensions - Git Extensions
    2. Visual SVN Server (also get eval license) - Visual SVN Server
    3. Chocolatey windows package manager - Chocolatey
    4. Git version 2.6.2 (use chocolatey in cmd: choco install git --version 2.6.2 )

    What to do:

    1. Get users who committed into authors file

    Open cmd to root of local svn project copy and run:

    svn log -q | awk -F '|' '/^r/ {sub("^ ", "", $2); sub(" $", "", $2); print $2" = "$2" <"$2">"}' | sort -u > authors-transform.txt

    Put the resulting authors file somewhere you can find it

    Open and Edit the authors-transform.txt file by adding the name and the email into the <> line by line for each committer


    2. Copy your SVN repository from the server to a local on your working drive (example: c:/repo/Repository


    3. Install Visual SVN and point the storage of the server to the /repo folder

    Also find an open port for it to run on

    Set permissions on the authentication to windows for the server You may have to create a user for the server as well Also set permissions for the specific project within the server to your user

    4. In the destination folder for your new cloned SVN repo hold shift and click Git Browse to open Git Extensions, go to Start, and click Clone SVN

    Point to the local svn server you created for the destination (example http://localhost/svn/repo/Repository/Development/ProjectName)

    I unchecked the trunk, tags, and branches but YMMV

    Point the authors file to wherever it is saved

    Click clone


    Reasons:

    Git 2.6.2 because it was the latest version that didn't cause an address issue

    Git Extensions because it minimized all the command line work for the cloning

    Visual SVN because I was having permissions issues on the server and the "git svn" commands responded better to an http://localhost..... address than the file:// that was suggested in the many places I researched

    Chocolatey because I didn't see any other way to get that version of Git

提交回复
热议问题