Cloning a git-svn repository with svn metadata

前端 未结 2 1131
执念已碎
执念已碎 2021-01-30 18:03

I\'ve cloned my main repository with git-svn clone svn://url/trunk --stdlayout. Now I want to clone the repository, with the svn meta data. So that I\'ll be able to

2条回答
  •  执笔经年
    2021-01-30 18:43

    Super-fast simple copy-clone between remote machines

    From the docs:

    'git clone' does not clone branches under the refs/remotes/ hierarchy or any 'git svn' metadata, or config. So repositories created and managed with using 'git svn' should use 'rsync' for cloning, if cloning is to be done at all.

    A copy-clone on the same machine can simply be done using cp -rp , and from a remote machine using scp -rCp .

    However, the remote case can be very very slow (10 minutes even on ethernet) because of the large number of tiny files it has to copy.

    Using cpio you can avoid this overhead, meaning (depending upon bandwidth) it just takes a few seconds (for a 100Mb git repo on a 50Mbit/s connection).

    ssh -C @ "cd ; \
    find  -depth -print | cpio -oa" | cpio -imd
    

    For example

    ssh -C alex@myhost "cd ~alex/repos/; \
    find WonderProject -depth -print | cpio -oa" | cpio -imd
    

    results in a new git repo 'WonderProject' in the current working directory on the local machine.


    (note that the documentation I refer to almost denies the existence of the section @Elazar refers to, so I'm not discrediting @Elazar's excellent solution, but looking for a more concise memorable one)

提交回复
热议问题