zl程序教程

您现在的位置是:首页 >  其他

当前栏目

git svn 错误 Can't locate SVN/Core.pm 的解决方案

错误CoreGit解决方案 svn can locate PM
2023-09-11 14:22:07 时间

【错误场景】

组里面要把代码从svn服务器里整体迁移到git上,准备两步走。
第一步,用 git svn转换成git仓库,
第二步,把git仓库提交到git服务器上。
本来是很快乐的事情,然而勇者在买装备的时候遇到了麻烦,在git svn的时候出错了。魔王只能再等我一会了。

操作系统

[counsellor@localhost git]$ cat /etc/redhat-release 
CentOS Linux release 7.2.1511 (Core)

git版本

[counsellor@localhost git]$ git --version
git version 2.12.0

svn版本

[counsellor@localhost git]$ svn --version
svn, version 1.9.4 (r1740329)
   compiled Jul 14 2016, 12:41:14 on x86_64-redhat-linux-gnu

perl版本

[counsellor@localhost git]$ perl --version

This is perl 5, version 16, subversion 3 (v5.16.3) built for x86_64-linux-thread-multi
(with 29 registered patches, see perl -V for more detail)

Copyright 1987-2012, Larry Wall

错误提示

cmd> git svn clone https://svn.xxxxxx.com/svn/myrepo --username=admin --no-metadata --authors-file=users.txt   myrepo

Can't locate SVN/Core.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/share/perl5/Git/SVN/Utils.pm line 6.
BEGIN failed--compilation aborted at /usr/local/share/perl5/Git/SVN/Utils.pm line 6.
Compilation failed in require at /usr/local/share/perl5/Git/SVN.pm line 32.
BEGIN failed--compilation aborted at /usr/local/share/perl5/Git/SVN.pm line 32.
Compilation failed in require at /usr/local/libexec/git-core/git-svn line 21.
BEGIN failed--compilation aborted at /usr/local/libexec/git-core/git-svn line 21.

【解决方案】

yum install subversion-perl

【问题分析】

先找到报错的第一现场:

/usr/local/share/perl5/Git/SVN/Utils.pm line 6

看代码:

package Git::SVN::Utils;

use strict; 
use warnings;

use SVN::Core;

可以看到是use SVN::Core;调用svn模块时,perl代码提示找不到svn模块。所以说明perl里没有svn相关的库,安装即可。