{"id":254058,"date":"2013-02-22T16:19:49","date_gmt":"2013-02-22T08:19:49","guid":{"rendered":"http:\/\/blog.zhenglei.net\/?p=254058"},"modified":"2013-03-12T15:35:26","modified_gmt":"2013-03-12T07:35:26","slug":"clone-svn-repository-into-git","status":"publish","type":"post","link":"https:\/\/blog.zhenglei.net\/?p=254058","title":{"rendered":"clone svn repository into git"},"content":{"rendered":"<p>## Install git-svn tool<br \/>\n# if CentOS<br \/>\nyum install subversion-perl<\/p>\n<p># if Ubuntu<br \/>\nsudo apt-get install libsvn-perl<\/p>\n<p>## In git server, Create empty repo of exfat as my project<br \/>\n<code><br \/>\n## Create Bare repo of \/repo\/exfat<br \/>\ncd \/repo<br \/>\ngit init --bare exfat.git<br \/>\ncd exfat.git<br \/>\ncp hooks\/post-update.sample hooks\/post-update<br \/>\ngit symbolic-ref HEAD refs\/remotes\/trunk<\/code><\/p>\n<p>## Clone svn with git-svn in work repo of \/repo\/svn\/exfat<br \/>\ncd \/repo\/svn<br \/>\ngit svn clone -s http:\/\/exfat.googlecode.com\/svn \/repo\/svn\/exfat<br \/>\ncd exfat<br \/>\ngit config core.worktree \/repo\/svn\/exfat<br \/>\ngit gc<\/p>\n<p>## Convert SVN Tag to Git Tag<br \/>\n\/usr\/local\/bin\/svn2git<\/p>\n<p>## \u00a0 Add svn ignore, if have<br \/>\ngit svn show-ignore &gt; .gitignore<br \/>\ngit add .gitignore<br \/>\ngit commit -m &#8216;Convert svn:ignore properties to .gitignore.&#8217;<\/p>\n<p># # Push git rep to bare repository<br \/>\ngit remote add origin \/repo\/exfat.git<br \/>\ngit push origin &#8211;mirror<\/p>\n<p>## Put other svn branch into bare repo<br \/>\n# git branch -r<br \/>\ngit checkout -t -b svn-trunk trunk<br \/>\ngit push origin &#8211;mirror<\/p>\n<p>git checkout -t -b svn-v1.0.x v1.0.x<br \/>\ngit push origin &#8211;mirror<\/p>\n<p>&nbsp;<\/p>\n<p>## Verify by checkout in workstation<br \/>\n<code><br \/>\ncd \/tmp\/test<br \/>\ngit clone ssh:\/\/git.zhenglei.net\/repo\/exfat.git<br \/>\ncd exfat<br \/>\n<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>## Install git-svn tool # if CentOS yum  &hellip; <a href=\"https:\/\/blog.zhenglei.net\/?p=254058\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[104],"class_list":["post-254058","post","type-post","status-publish","format-standard","hentry","category-linux","tag-git"],"_links":{"self":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=254058"}],"version-history":[{"count":45,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254058\/revisions"}],"predecessor-version":[{"id":254080,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=\/wp\/v2\/posts\/254058\/revisions\/254080"}],"wp:attachment":[{"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=254058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=254058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhenglei.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=254058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}