20

I'm using OSX and want get a svn repo into a local git repo using sourcetree.

When I add a bookmark using sourcetree using SVN URL, thus sourcetree knows it's a SVN url, but when I click the clone button, it reports an error like following:

Can't locate SVN/Core.pm in @INC (@INC contains: /usr/local/git/lib/perl5/site_perl /Applications/SourceTree.app/Contents/Resources/git_local/lib/perl5/site_perl /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.4 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .) at /Applications/SourceTree.app/Contents/Resources/git_local/lib/perl5/site_perl/Git/SVN/Editor.pm line 5.
BEGIN failed--compilation aborted at /Applications/SourceTree.app/Contents/Resources/git_local/lib/perl5/site_perl/Git/SVN/Editor.pm line 5.
Compilation failed in require at /Applications/SourceTree.app/Contents/Resources/git_local/libexec/git-core/git-svn line 81.
BEGIN failed--compilation aborted at /Applications/SourceTree.app/Contents/Resources/git_local/libexec/git-core/git-svn line 81.

I don't how to get it through. Can anyone give me a pointer on how to do this?

k1eran
  • 4,492
  • 8
  • 50
  • 73
wshcdr
  • 935
  • 2
  • 12
  • 27
  • There is no notion of "cloning" an SVN repository as there is in git. They work completely differently. With Subversion, you **check out** a working copy from a repository (or more commonly, a subset of a repository) - you do not pull down an entire copy of the repository. – alroc Jun 26 '13 at 13:02
  • I have resovled this issue, cause something wrong with the new xcode perl configuration. anyway, thank you for ur concern. – wshcdr Sep 22 '13 at 16:41
  • 1
    I finally solved this according this link http://victorquinn.com/blog/2012/02/19/fix-git-svn-in-mountain-lion/ – wshcdr Sep 23 '13 at 02:17
  • @wshcdr you should write that up as the answer. – ThomasW Apr 22 '14 at 15:51

10 Answers10

43

I hit this missing SVN/Core.pm issue recently with el capitain.

Fix I used was from Paul Schreiber's blog :

sudo mkdir /Library/Perl/5.18/auto
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi‌-2level/SVN /Library/Perl/5.18/darwin-thread-multi-2level
sudo ln -s /Applications/Xcode.app/Contents/Developer/Library/Perl/5.18/darwin-thread-multi‌-2level/auto/SVN /Library/Perl/5.18/auto/


Commenters below, say this worked on sierra and high sierra too.

k1eran
  • 4,492
  • 8
  • 50
  • 73
10

Or, if you don't have Xcode, just CommandLineTools (this is on ElCapitan 10.11.6):

sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level/SVN /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/SVN
sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin-thread-multi-2level/auto/SVN /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/auto/SVN

If you previously linked some older version or just made a mistake so it gives you: File exists, then you should first do

sudo unlink /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level/SVN

for whichever file was reported as already existent, of course.

EDIT Dir doesn't exist: (suggested by @rogeriopradoj)

mkdir -p /usr/local/git/lib/perl5/site_perl/5.18.2/darwin-thread-multi-2level

EDIT Sierra:
After upgrading to Sierra I lost CommandLineTools, so I just had to reinstall it and everything was back to normal.
This will prompt you to install just the CommandLineTools, not the whole XCode.

xcode-select --install

Hope this helps someone :)

Marko Bonaci
  • 5,622
  • 2
  • 34
  • 55
  • I don't have XCode, but am on High Sierra. The ln -s commands in this answer worked on High Sierra for me. – mojave Jun 07 '18 at 19:00
  • 1
    `xcode-select --install` turned out to be all I needed to do on Mojave. Thanks! – Reid Nov 06 '18 at 16:51
5

In my case, it is because different versioned perl was installed by brew as dependency of some formula, and override the system's default version.

So the resolution for me is to relieve the overridden as described following.


when type which perl and perl -v, I find it not the system default version:

# locate programs
faner@MBP-FAN:~|⇒  whereis perl
/usr/bin/perl

# locate a program file in the user's path
faner@MBP-FAN:~|⇒  which perl
/usr/local/bin/perl

faner@MBP-FAN:~|⇒  perl -v

This is perl 5, version 26, subversion 1 (v5.26.1) built for darwin-thread-multi-2level

which should be v5.18.2 according to the git svn error messages.

I guess it is because the different versioned perl was installed by brew as dependency of some formula, and override the system default version.

faner@MBP-FAN:~|⇒  brew uses perl --installed
subversion

To prove it, try to move /usr/bin before /usr/local/bin in $PATH, then perl was fallback to the system's default version:

faner@MBP-FAN:~|⇒  echo $PATH
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

faner@MBP-FAN:~|⇒  PATH=/usr/bin:$PATH
faner@MBP-FAN:~|⇒  echo $PATH
/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin

faner@MBP-FAN:~|⇒  whereis perl
/usr/bin/perl

faner@MBP-FAN:~|⇒  which perl
/usr/bin/perl

faner@MBP-FAN:~|⇒  perl -v

This is perl 5, version 18, subversion 2 (v5.18.2) built for darwin-thread-multi-2level
(with 2 registered patches, see perl -V for more detail)

and perl -V list the @INC just satisfy the Can't locate SVN/Core.pm in @INC requirements:

faner@MBP-FAN:~|⇒  perl -V
Summary of my perl5 (revision 5 version 18 subversion 2) configuration:

  @INC:
    /Library/Perl/5.18/darwin-thread-multi-2level
    /Library/Perl/5.18
    /Network/Library/Perl/5.18/darwin-thread-multi-2level
    /Network/Library/Perl/5.18
    /Library/Perl/Updates/5.18.2
    /System/Library/Perl/5.18/darwin-thread-multi-2level
    /System/Library/Perl/5.18
    /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level
    /System/Library/Perl/Extras/5.18

type git svn and everything works well!

faner@MBP-FAN:~|⇒  git svn --version
git-svn version 2.15.1 (Apple Git-101) (svn 1.9.7)
fan2
  • 181
  • 2
  • 4
2

Manage to fix the same issue by changing the first line in /usr/local/Cellar/git/2.29.2/libexec/git-core/git-svn to #!/usr/local/bin/perl

sten
  • 61
  • 6
1

Plus to the highest answer, If you are using souceTree, simply paste command line may not work immediately. In that case, you may need to check git used in your sourceTree, which should be set as System git.

Fran Fang
  • 11
  • 2
1

Xcode 11.4 no longer includes SVN/Core.pm in its Perl bindings!

If you've never installed the commandline tools and Xcode 11.4 is the first version you've run you will see this issue. Running xcode-select --install returns error: command line tools are already installed, use "Software Update" to install updates, which is accurate but non-obvious that your installed commandline tools differ from what you would get if installed outside of Xcode 11.4. The solution is to first remove these, then install the commandline tools using xcode-select.

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
L.Stomberg
  • 13
  • 4
0

Thanks Marko, I did find that on ElCapitan 10.11.3 I had to symlink to a different area. Not sure why, but it works.

sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin‌​-thread-multi-2level‌​/SVN /Applications/SourceTree.app/Contents/Resources/git_local/li‌​b/perl5/site_perl/5.‌​18.2/darwin-thread-m‌​ulti-2level/SVN
sudo ln -s /Library/Developer/CommandLineTools/Library/Perl/5.18/darwin‌​-thread-multi-2level‌​/auto/SVN /Applications/SourceTree.app/Contents/Resources/git_local/li‌​b/perl5/site_perl/5.‌​18.2/darwin-thread-m‌​ulti-2level/auto/SVN
Mark
  • 330
  • 2
  • 9
0

I got the same issue on Macos Mojave 10.14.1. Because I used the built-in version of git, and it's too lower(2.19.0). I fixed it by upgrade git to the latest version(2.21.0), and I found 2.19.1 also has no this issue.

Terry Chen
  • 369
  • 3
  • 16
0

The solution for me was to delete the password entry in the OSX key ring app, and have git svn re-create it. My key entry has been created earlier (by svn I suppose), and it seems that git cannot use this key entry (nor fix it nor add a second one).

The long story: I noticed that when unsing "system git" in SourceTree, there seemed to be a problem storing the credentials. When I entered the same git command (that SourceTree is issuing) on the command-line, git kept prompting me for my password each time.

Then I found https://stackoverflow.com/a/39800112/580672

If you are interested, my setup was:

I had tried with no success:

  • "embedded git" (yields the @INC error)
  • "system git" (different error: "Username: Use of uninitialized value $ret in chomp at /usr/local/Cellar/git/2.21.0/share/perl5/Git.pm line 596.")
  • put usr/bin in front of my PATH as suggested above
  • force-uninstalled perl in homebrew

All without success. The solution was system git and the key entry, as stated above.

Philippp
  • 847
  • 1
  • 8
  • 17
0

I've found that the best solution is to expand the list of directories in @INC using an export

export PERL5LIB=/Applications/Xcode.app/Contents/Developer/Library/Perl/5.18

Referenced from: https://perlmaven.com/how-to-change-inc-to-find-perl-modules-in-non-standard-locations

polarise
  • 2,303
  • 1
  • 19
  • 28