标签云

微信群

扫码加入我们

WeChat QR Code

I read the Git manual, FAQ, Git - SVN crash course, etc. and they all explain this and that, but nowhere can you find a simple instruction like:SVN repository in: svn://myserver/path/to/svn/reposGit repository in: git://myserver/path/to/git/reposgit-do-the-magic-svn-import-with-history \svn://myserver/path/to/svn/repos \git://myserver/path/to/git/reposI don't expect it to be that simple, and I don't expect it to be a single command. But I do expect it not to try to explain anything - just to say what steps to take given this example.


It is getting easier, I just completed it myself and documented my findings with the help of SO jmoses.co/2014/03/21/moving-from-svn-to-git.html

2019年10月20日36分01秒

Use Casey's answer below, but before you run the "svn clone ..." command, see how to add the extra "Visual SVN Server" line to your user.txt file... here: stackoverflow.com/questions/8971208/…

2019年10月20日36分01秒

Also, if you have the "make email private option checked in your GitHub profile, use this as your email address in users.txt to match. yourgituserusers.noreply.github.com, so your real email address doesn't show up on commits.

2019年10月20日36分01秒

The answer from Casey answers the original question much better.

2019年10月20日36分01秒

Will this keep the branches and everything? or just clone the trunk?

2019年10月20日36分01秒

Eildosa: This will just clone the trunk. See Casey's answer for an alternative.

2019年10月20日36分01秒

DougWilson but I can't see any Casey's answer here. Is it the answer below with 13 authors that begins with "Create a users file"?

2019年10月20日36分01秒

For anyone else who's wondering which is "Casey's answer" which is referenced in lots of comments around here, it's this one (Casey changed his nick to cmcginty).

2019年10月20日36分01秒

This blog post by Eelke is a great cross-reference for the answer above. blokspeed.net/blog/2010/09/converting-from-subversion-to-git

2019年10月20日36分01秒

This is 99% awesome, following these steps, I got everything in order except branches: after the final step, they were remote only (and as such disappeared when I did the command: git remote rm origin)

2019年10月20日36分01秒

I just used this procedure and it worked pretty well. My observations are: 1) the process for converting "tag branches" to tags still leaves the branches (albeit unlabelled). If you created the tag in SVN without modifying the content, then you can actually tag the preceding commit and delete the "tag-branch" for cleaner history. 2) no mention is made of migrating the svn:ignore attributes. This is covered elsewhere on The Internet. See also 'git svn show-ignore'. 3) the final clone didn't benefit me. Indeed, I ended up with remote refs to the original dir, which was odd.

2019年10月21日36分01秒

GitHub has a very convenient step-by-step: github.com/nirvdrum/svn2git#readme

2019年10月20日36分01秒

For those under Windows, I created a PowerShell script based on this method: gist.github.com/Gimly/90df046dc38181bb18de

2019年10月20日36分01秒

As I commented on the other answer, I had to remove the spaces around = in users.txt because the import was aborting and I was getting an empty repository.

2019年10月20日36分01秒

Ah! Simple and effective explanation. In my case file:/// refused to work, just I used svnserve.exe --daemon and then used svn://localhost/home/user/repo instead.

2019年10月20日36分01秒

On my Mac running Mountain Lion, git svn wouldn't work until I went into Xcode and installed the Command Line Tools found in the Downloads tab of the Preferences pane.Alternatively, I could have installed just the Command Line Tools for OS X Mountain Lion found on Apple's Developer site.

2019年10月20日36分01秒

For my case I had to convert the file authors.txt to utf-8 without BOM.

2019年10月20日36分01秒

That link seems to be missing some information

2019年10月20日36分01秒

Q: does this fix spaces in tag and branch names (allowed in svn and not allowed in git)?

2019年10月20日36分01秒

This guide to use it is helpful: troyhunt.com/2014/08/migrating-from-subversion-to-git-with.html

2019年10月20日36分01秒

This failed for me with a problem:groups.google.com/forum/#!topic/msysgit/7MQVwRO-2N4- see also: github.com/nirvdrum/svn2git/issues/50The solution was here:stackoverflow.com/questions/3009738/…

2019年10月20日36分01秒

It's preferable to explain answers otherwise we produce script kiddies.

2019年10月20日36分01秒

What about if your branches are all in the root of SVN and you have no trunk or tags?

2019年10月20日36分01秒

Extremely helpful, this worked perfectly.I would add that there is one final step to take if you are synching to a remote repository.After the git config steps, I needed to git push origin master

2019年10月20日36分01秒

Note that a one-time import (using the subgit import command) doesn't even seem to require a license. Accurate translation of the svn:ignore property to .gitignore files is included, too.

2019年10月20日36分01秒

SubGit would not recognize my private key, nor any flags that I set in the command line. Documentation is very poor. This is not a viable alternative for git svn.

2019年10月20日36分01秒

error: 'svn_repos' is not a valid configured location; SubGit configuration file is missing.

2019年10月20日36分01秒

The Pro Git explanation includes migrating the tags and branches.It uses a local mv rather than svn commands. clever.

2019年10月20日36分01秒

This page is wonderful, and is IMHO the best answer!It does most of the grunt work for you.

2019年10月20日36分01秒

GitHub's current recommendation is to use the svn2git program suggested in another answer.

2019年10月20日36分01秒

Imported two quite big projects just now flawlessly. All SVN branches got imported (just remember NOT using \trunk part in repo path). One thing I don't know yet is that whether Github would track new commits.

2019年10月20日36分01秒

I would propose to combine this info with this link: sailmaker.co.uk/blog/2013/05/05/…

2019年10月20日36分01秒

That link doesn't work.

2019年10月20日36分01秒

Try the wayback machine at archive.org

2019年10月20日36分01秒

Thank you, supereasy and fast!

2019年10月20日36分01秒

Thank you.This worked for me.I am using SourceTree and Stash.

2019年10月20日36分01秒

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.Link-only answers can become invalid if the linked page changes.

2019年10月20日36分01秒

I disagree.The linked content might change, and the content duplicated here will not be updated, and therefore might be out of date (and in fact I believe it has changed since I originally posted this answer).The guidelines only say to include some relevant context for a link, which I did -- the actual question was answered wholesale by the link.Copying the whole linked resource here is not required or necessary.Was I downvoted for this?!

2019年10月20日36分01秒

Reference for guidelines: stackoverflow.com/help/how-to-answer

2019年10月20日36分01秒

I used this script. After a bit of trail and error, it worked for me. Please be advised that you need Git 1.8.3+ for this, as --follow-tags is only supported thereafter.

2019年10月20日36分01秒

This answer helped me to move all my repositories to BitBucket without problems.

2019年10月20日36分01秒

Glad to hear. I had only experience with Gitea... but tranferred ~~40 repos this way.

2019年10月20日36分01秒

Very nice! Thnx

2019年10月21日36分01秒

warning; I experienced bad charset issues. I recognized this really too late but it took me several hours fixing. Please check that your resulting repo contains the exact(!) expected sources

2019年10月20日36分01秒