git - how can I clone local svn repository?
Solution 1
You should be able to succeed like this:
git svn clone file:///e/svn_repo_on_E_drive
Similar to svn checkout command:
svn co file:///e/svn_repo_on_E_drive
file://
for folder on the current drive of the executing CMD prompt, file:///d/some_folder
for D:\some_folder
.
Note: The extra /
and the removed colon :
in the file link on Windows. file://e:/svn_repo_on_E_drive
→ file:///e/svn_repo_on_E_drive
Solution 2
For a local repository you use a file://
URL, same as would be used for doing
a checkout with the normal svn client.
If you're trying to copy the entire history, and using git svn clone
--stdlayout
just use the URL that you would use to checkout the trunk with svn
minus the /trunk
portion at the end.
Bulwersator
Updated on June 09, 2021Comments
-
Bulwersator almost 3 years
I am completely unable to find any explanation how I should specify location of existing svn repository.
In other words - what should be used as URL in
git svn clone URL
when svn repository is local?
-
Bulwersator about 11 yearsSo file:///X:/path/to/repos should work? Weird, as it fails with "Couldn't open a repository: Unable to open an ra_local session to URL: Unable to open repository"
-
qqx about 11 years
file://
URLs work for me. No idea about the drive specifier portion, I don't use windows. -
Francesco Frassinelli about 11 yearsFrom your last comment I suppose you're using Windows. Try to remove the third "/". Maybe it doesn't work because there's a bug: code.google.com/p/tortoisegit/issues/detail?id=1402
-
Crayon over 8 yearsYou need to remove the colon ( : ) from the drive letter. So instead of file:///X:/path/to/repos you need to use file:///X/path/to/repos
-
kurast about 7 yearsI was having a problem with this approach until I removed the colon (:) from drive on the file URL. Usually, in windows you see this file:///e:/svn_repo_on_E_drive , but for git you need to remove the ':' from the drive, leaving file:///e/svn_repo_on_E_drive
-
zionyx about 7 yearsThanks @kurast, i'll make the answer more obvious to remove it.
-
flohack almost 6 yearsFor me it does not work in any combination of /// and other things: Can't create session: Unable to connect to a repository at URL 'file://d/temp/xxxx': Local URL 'file://d/temp/xxxx' contains unsupported hostname at / mingw64/share/perl5/site_perl/Git/SVN.pm line 144.
-
zionyx almost 6 years@flohack, based on the syntax, i assume you are using the command on Windows? Have you tried
file:///d/temp/xxxx
? What's the full command used when you get the error? -
flohack almost 6 yearsWith 3 /// I get slightly different result: $ git svn clone file:///d/temp/xxxx/ Initialized empty Git repository in D:/yyyy.lt/git/xxxx/.git/ Can't create session: Unable to connect to a repository at URL 'file:///d/temp/xxxx': Unable to open repository 'file:///d/temp/xxxx' at /mingw64/share/perl5/site_perl/Git/SVN.pm line 144.
-
zionyx almost 6 yearsUnfortunately no. I am able to reproduce the same error you guys get. Which means, the behavior of Git has changed over time? Hmm.
-
flohack almost 6 yearsI finally installed svn+ssh server only to do this import :)
-
zionyx almost 6 yearsYes, of course, you can use svnserve to serve so you can use
svn://
overfile:///
. A great workaround! -
zionyx almost 6 yearsTry to create a symbolic link of the repository in a different drive to the new location, then you do not need to mess with drive letters in your
file:///
. -
Azghanvi almost 3 yearsYour reply saved my old repo which i was going to dump. Unable to find anywhere else: file://e:/svn_repo_on_E_drive → file:///e/svn_repo_on_E_drive
-
bitmountain over 2 yearsCan not make it work. Got this error:
Unable to open repository 'file:///d/projects/xxx' at C:/Program Files/Git/mingw64/share/perl5/Git/SVN.pm line 310.
I am using the git version ofversion 2.34.0.windows.1
.