我准备使用 git svn clone -s svn://xxx 从 svn repo(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 存储库:
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 存储库中没有从 svn 存储库克隆的标签:
[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 仓库中有 388 个标签,那么如何修复我的本地 .git 仓库呢?
我应该重新启动才能从远程 svn 服务器进行 git clone 吗?
我已经尝试了很多次,都是同样的问题:(
最佳答案
基本上 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 svnbranch”命令。
关于version-control - git svn 中断,然后我丢失了所有标签,如何修复?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11999914/