Vicky
Vicky

Reputation: 1389

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?

Upvotes: 15

Views: 15475

Answers (4)

Mike Nakis
Mike Nakis

Reputation: 62045

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.

Upvotes: 2

Archimedes Trajano
Archimedes Trajano

Reputation: 41480

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

Upvotes: 5

Matt Vukomanovic
Matt Vukomanovic

Reputation: 1440

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.

Upvotes: 4

Ivan Zhakov
Ivan Zhakov

Reputation: 4041

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

Upvotes: 18

Related Questions