简体   繁体   中英

How can I use "git-svn" to checkout a local svn repository?

I'm practicing how to use svn and git.

I created a svn repository on my computer, at "/Users/name/svnRepo/test". I am able to use the svn commands to work on this repository.

Then, I tried to use command "git-svn clone FILE:///Users/name/svnRepo/test/ ." , and got an error:

Initialized empty Git repository in ... Bad URL passed to RA layer: Unable to open an ra_local session to URL: Local URL 'FILE:///Users/name/svnRepo/test' does not contain 'file://' prefix at /usr/local/git/libexec/git-core/git-svn line 1775

Could anyone help?

Scheme part of URL is case-sensitive. Try to use "git-svn clone file:// /Users/name/svnRepo/test/ ." command.

If you want to use a local SVN repository with git-svn on Windows, you need to use a downgraded version of the repository until this bug which is marked as wontfix is fixed https://code.google.com/p/msysgit/issues/detail?id=253

svnadmin create c:\repo --pre-1.4-compatible

Then load up the repository using a dump file

svnadmin load C:\repo < svn.dump

Once you have that done you can use the following command

git svn clone file:///c/repo git-repo

I was having the same problem too. I am running on windows.

I did a work around, I downloaded the VisualSVN server and pointed that to where my repositories were.

I then needed to add a user to the svn server so that I could pull from it.

Then instead of trying to run this command

git svn clone file:///F:/Repositories/Main/SubProj --stdlayout SubProj

i ran this command instead

git svn clone https://localhost/svn/Main/SubProj --stdlayout SubProj

which worked fine.

Under windows, the magical incantation that does the trick is as follows:

git svn clone file:///c/Users/name/...

In other words, after file: you need three slashes, then a c , (assuming you are working on drive C: ,) then one more slash instead of a colon, then the rest of the path.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM