Make bare repository out of git svn init

使用git-svn建立一个subversion代码库的git库的操作过程。

git svn init https://172.19.49.185:3690/svn/AS_BOSS_SVN -T JFZW/trunk/code/cbs repo.tmp --username=l39885
cat repo.tmp/.git/config | \
sed 's#:refs/remotes/trunk#:refs/heads/master#' | \
sed 's#:refs/remotes/\*#:refs/heads/*#' | \
sed 's#:refs/remotes/tags/\*#:refs/tags/*#' \
> repo.tmp/.git/config.tmp
mv repo.tmp/.git/config.tmp repo.tmp/.git/config
git --git-dir=repo.tmp/.git config --bool core.bare true
mv repo.tmp/.git repo.git
# git --git-dir=repo.git svn fetch -r373135
git --git-dir=repo.git svn fetch
git --git-dir=repo.git svn gc
git --git-dir=repo.git gc --aggressive

然后在另外一台机器上建立一个mirror clone。(备份很重要!)

git clone --mirror cbs@10.164.129.24:/srv/git/repo.git /srv2/git/repo.git

原文地址:https://www.cnblogs.com/luojunqiang/p/2685415.html