简体   繁体   English

git-svn 不是 git 命令?

[英]git-svn not a git command?

While attempting to get an old svn dump of a project under git control, I ran into an interesting problem.在尝试获取 git 控制下的项目的旧 svn 转储时,我遇到了一个有趣的问题。 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 .每当我运行git svn ,我都会收到一条错误消息,指出它不是 git 命令,但我可以使用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:编辑:我可能还应该提到我在 Windows XP 下运行 msysGit 版本 1.6.1.9.g97c34,我得到的错误是:

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

Did you mean one of these?
        fsck
        show

I just check on my newly installed ubuntu box and it wasn't installed even with git-core installed.我只是检查了我新安装的 ubuntu 盒子,即使安装了 git-core,它也没有安装。 A simple:一个简单的:

sudo apt-get install git-svn

or your distro equivalent should fix it.或者你的发行版等价物应该修复它。

On Ubuntu:在 Ubuntu 上:

sudo add-apt-repository ppa:git-core/ppa
apt-get update
sudo apt-get install git-svn

I am not sure that git svn has ever worked with recent Git Windows distribution (post 1.5.6).我不确定git svn 是否曾经使用过最近的 Git Windows 发行版(1.5.6 后)。

Many problems have been reported before, so git svn may very much be not included in current msysGit releases.之前已经报告了许多问题,因此git svn可能不会包含在当前的 msysGit 版本中。

Another current active "Git on Windows" development mingw.git does state in its README that svn does not work.另一个当前活跃的“Windows 上的 Git”开发mingw.git在其自述文件中声明 svn 不起作用。

This thread of Msysgit does suggest that git svn may be reintegrated at some points, but progress are still slow. Msysgit 的这个线程确实表明 git svn 可能会在某些时候重新集成,但进展仍然缓慢。


Update: from MSysGit1.6.2 (early March 2009), git-svn works again .更新:从 MSysGit1.6.2(2009 年 3 月上旬)开始, git-svn再次工作 See this SO question .看到这个问题


Update: with a modern (2017) Git for Windows 2.x , git svn is already included.更新:使用现代 (2017) Git for Windows 2.xgit svn已经包含在内。
No need for sudo apt-get install git-svn , which would only be possible in a WSL (Windows Subsystem for Linux) shell session anyway.不需要sudo apt-get install git-svn ,这只能在WSL(Linux 的 Windows 子系统)shell 会话中实现

对于后代:在 CentOS 7 上,只需运行sudo yum install git-svn

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.因为我没有安装 Subversion Perl 绑定。 Try installing them and running the command again.尝试安装它们并再次运行命令。

It wasn't installed on my fresh install of Ubuntu on WSL -它没有安装在我在 WSL 上全新安装的 Ubuntu 上 -

sudo apt install git-svn

sorted it:排序它:

❯ git svn
git-svn - bidirectional operations between a single Subversion tree and git
...

I had the same error under Cygwin 1.7.我在 Cygwin 1.7 下有同样的错误。 It was solved by installing the git-svn package with Cygwin setup.它是通过使用 Cygwin 安装程序安装 git-svn 包来解决的。

在 Gentoo 上,您应该使用 USE="subversion" 构建 git

MacPorts version: MacPorts 版本:

port install git +svn

(Note: you likely need to port deactivate git first) (注意:您可能需要先port deactivate git

Had a similar problem on RHEL6, ie,在 RHEL6 上有类似的问题,即,

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.在@INC 中找不到 Git/SVN.pm(@INC 包含:/usr/local/share/perl5 /usr/local/lib64/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl / usr/lib64/perl5 /usr/share/perl5 .) 在 /usr/local/libexec/git-core/git-svn 第 25 行。

My solution:我的解决方案:

sudo yum install subversion-perl
chmod 755  /usr/local/share/perl5/ (and sub dirs, as they were only readable by root)

在我使用的 CentOS 上

sudo yum install git-svn

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.如果 git-svn 不是 mSysGit 的一部分,我建议使用一个小型 UNIX 服务器来托管您的网关存储库,该存储库克隆您的 svn 存储库,然后将该存储库克隆到您的 Windows 机器上。 This is the approach I am using for interacting with CVS from git.这是我用来从 git 与 CVS 交互的方法。

在 Fedora 上,我必须安装它

sudo dnf install -y git-svn

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM