【发布时间】:2015-01-26 20:43:06
【问题描述】:
当我运行 git checkout --patch origin/master file.java 时,我看到:
Can't locate Git.pm in @INC (you may need to install the Git module)
(@INC contains:
/usr/share/perl/5.14.2
/usr/local/perl/lib/site_perl/5.20.0/x86_64-linux
/usr/local/perl/lib/site_perl/5.20.0
/usr/local/perl/lib/5.20.0/x86_64-linux /usr/local/perl/lib/5.20.0 .)
at /usr/lib/git-core/git-add--interactive line 7.
BEGIN failed--compilation aborted at /usr/lib/git-core/git-add--interactive line 7.
我在 Ubuntu 12.04.4 LTS 上运行它。 git 的版本是 1.7.9.5。 perl 是 perl5, version 20, subversion 0 (v5.20.0) build for x86_64-linux。
【问题讨论】:
-
应该有
/usr/share/perl5/Git.pm(来自git包,用dpkg -L git | grep Git验证它的存在)和/usr/share/perl5目录应该在默认的perl5搜索路径中 -
我已经用user3159253的方法解决了这个问题。 /usr/share/perl5/Git.m 存在,但 /usr/share/perl5 不在默认的 perl 搜索路径中(使用 perl -V)。然后我将 export PERL5LIB=/usr/share/perl5 添加到 ~/.bashrc 中。然后它运作良好。谢谢。
-
对于那些在 OS X 上遇到这个问题的人,请查看stackoverflow.com/q/17736330/72321