【问题标题】:git svn interrupted, then i lost all the tags, how to fix it?git svn 中断,然后我丢失了所有标签,如何修复它?
【发布时间】:2012-08-13 13:19:29
【问题描述】:

我准备使用 git svn clone -s svn://xxx 从 svn repo (on centos) 克隆代码,然后因为奇怪的问题被中断,错误信息如下:

Following parent with do_switch
Successfully followed parent
Use of uninitialized value in concatenation (.) or string at /usr/lib/perl5/vendor_perl/5.8.8/i386-linux-thread-multi/SVN/Core.pm line 584.
Network connection closed unexpectedly:  at /usr/libexec/git-core/git-svn line 2693

然后我继续这个克隆过程使用

    time git svn fetch -r HEAD

一切顺利,终于成功克隆了那个svn repo:

W: -empty_dir: trunk/src/os/win32/ngx_gui.c
W: -empty_dir: trunk/src/os/win32/ngx_gui.h
W: -empty_dir: trunk/src/os/win32/ngx_gui_resources.h
W: -empty_dir: trunk/src/os/win32/ngx_shared.h
W: -empty_dir: trunk/src/os/win32/ngx_types.h
r4817 = 7b58fc00b5b8ebb0544053ecf63e53b28935f15b (refs/remotes/trunk)
Auto packing the repository for optimum performance. You may also
run "git gc" manually. See "git help gc" for more information.
Counting objects: 12449, done.
Compressing objects: 100% (12177/12177), done.
Writing objects: 100% (12449/12449), done.
Total 12449 (delta 9475), reused 0 (delta 0)
Checked out HEAD:
  svn://svn.nginx.org/nginx/trunk r4817

real    0m9.630s
user    0m6.015s
sys     0m1.870s

奇怪的问题是我的本地 git repo 中没有标签,它是从 svn repo 克隆的:

[root@home nginx]# git branch
* master
[root@home nginx]# git tag   // no tags at all:(

[root@home nginx]# svn ls svn://svn.nginx.org/nginx/branches | wc -l
7
[root@home nginx]# svn ls svn://svn.nginx.org/nginx/tags | wc -l
388

事实上,svn repo 中有 388 个标签,那么如何修复我的本地 .git repo?

我应该从远程 svn 服务器重新启动 git clone 吗?

我试过很多次,同样的问题:(

【问题讨论】:

    标签: version-control nginx centos git-svn


    【解决方案1】:

    基本上 git-svn 不支持标签作为 Git 标签。为了将 SVN 标签转换为 Git 标签,您可以使用:

    • SubGit(+也许是svnsync,如果您无法访问带有 SVN 存储库的服务器)
    • git-svn + 参考更新命令: "git update-ref refs/tags/TAGNAME refs/remotes/tags/TAGNAME"
    • SmartGit,如果你想要一些 UI 而不是编写脚本

    但请注意:只有第一种和第三种解决方案允许您将标签推送到服务器以与 SVN 标签相关联。使用 git-svn 你应该使用额外的“git svn branch”命令。

    【讨论】:

      猜你喜欢
      • 2018-05-30
      • 2012-04-28
      • 2014-09-01
      • 1970-01-01
      • 2018-09-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-22
      相关资源
      最近更新 更多