125

While attempting to get an old svn dump of a project under git control, I ran into an interesting problem. Whenever I run git svn, I get an error saying it isn't a git command, yet there is documentation for it that I can pull up using git help. Is there something wrong with my install, or am I just missing something here?

Edit: I should probably also mention that I am running msysGit version 1.6.1.9.g97c34 under Windows XP, and the error I get is:

$ git svn 
git: 'svn' is not a
git-command. See 'git --help'.

Did you mean one of these?
        fsck
        show

13 Answers 13

290

I just check on my newly installed ubuntu box and it wasn't installed even with git-core installed. A simple:

sudo apt-get install git-svn

or your distro equivalent should fix it.

33

On Ubuntu:

sudo add-apt-repository ppa:git-core/ppa
apt-get update
sudo apt-get install git-svn
4
  • 5
    The ppa is optional. git-svn is included in the standard repository.
    – jgomo3
    Sep 4, 2016 at 2:14
  • Old question but still when git-svn is installed on Ubuntu, I think it should be added that we have to use git svn and not git-svn
    – nsaura
    Nov 5, 2018 at 10:43
  • I needed the ppa part on Ubuntu 16. Dec 19, 2018 at 4:21
  • apt-get update needs sudo also. I've tried to update the response but since the edit is less than 6 characters SO doesn't allow me to do it Apr 23, 2020 at 16:29
20

I am not sure that git svn has ever worked with recent Git Windows distribution (post 1.5.6).

Many problems have been reported before, so git svn may very much be not included in current msysGit releases.

Another current active "Git on Windows" development mingw.git does state in its README that svn does not work.

This thread of Msysgit does suggest that git svn may be reintegrated at some points, but progress are still slow.


Update: from MSysGit1.6.2 (early March 2009), git-svn works again. See this SO question.


Update: with a modern (2017) Git for Windows 2.x, git svn is already included.
No need for sudo apt-get install git-svn, which would only be possible in a WSL (Windows Subsystem for Linux) shell session anyway.

3
  • git svn is certainly bundled with Git now on Windows :) Dec 13, 2013 at 0:50
  • 1
    @TodThomson I agree, and that is what my update from March 2009 is saying.
    – VonC
    Dec 13, 2013 at 6:48
  • 4
    for windows 10 users sudo apt-get install git-svn
    – behelit
    Nov 13, 2017 at 23:17
8

It wasn't installed on my fresh install of Ubuntu on WSL -

sudo apt install git-svn

sorted it:

❯ git svn
git-svn - bidirectional operations between a single Subversion tree and git
...
1
  • I tried this solution and works. Thank you.
    – Kenjiro
    Feb 6, 2021 at 14:15
7

Under my system I've had this trouble:

$ git svn
Can't locate SVN/Core.pm in @INC (@INC contains: /usr/lib/perl5/site_perl/5.10.0
/usr/lib/perl5/5.10.0/i486-linux-thread-multi
/usr/lib/perl5/5.10.0
/usr/lib/perl5/site_perl/5.10.0/i486-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.8
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.10.0/i486-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.10.0
/usr/lib/perl5/vendor_perl/5.8.8
/usr/lib/perl5/vendor_perl .) at
/usr/libexec/git-core/git-svn line 29.

because I don't have Subversion Perl bindings installed. Try installing them and running the command again.

1
  • 3
    I've also seen this with the Perl bindings installed in a different location than Git expected; corrected with a symlink.
    – Paul
    Feb 9, 2009 at 6:29
7

For posterity: On CentOS 7, just run sudo yum install git-svn.

4

I had the same error under Cygwin 1.7. It was solved by installing the git-svn package with Cygwin setup.

4

MacPorts version:

port install git +svn

(Note: you likely need to port deactivate git first)

3

On Gentoo , you should build git with USE="subversion"

3

On CentOS I used

sudo yum install git-svn
2

Had a similar problem on RHEL6, i.e.,

Can't locate Git/SVN.pm in @INC (@INC contains: /usr/local/share/perl5 /usr/local/lib64/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/libexec/git-core/git-svn line 25.

My solution:

sudo yum install subversion-perl
chmod 755  /usr/local/share/perl5/ (and sub dirs, as they were only readable by root)
1
  • This was exactly my issue. The /usr/local/share/perl5 directory and contents needed those permissions. Thank you! Feb 7, 2019 at 19:01
1

If git-svn is not part of mSysGit, I recommend using a small UNIX server to host your gateway repository that clones your svn repository, and then clone that repository onto your Windows machine. This is the approach I am using for interacting with CVS from git.

0

On Fedora I had to install it with

sudo dnf install -y git-svn

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.