这个svn2git错误是什么意思?

His*_*ham 31 svn git git-svn

我正在尝试使用svn2git将我的存储库从svn导入到git,但是当它遇到分支时似乎失败了.有什么问题?

Found possible branch point: https://s.aaa.com/repo/trunk/project => https://s.aaa.com/repo/branches/project-beta1.0, 128
Use of uninitialized value in substitution (s///) at /opt/local/libexec/git-core/git-svn line 1728.
Use of uninitialized value in concatenation (.) or string at /opt/local/libexec/git-core/git-svn line 1728.
refs/remotes/trunk: 'https://s.aaa.com/repo' not found in ''

Running command: git branch -l --no-color
* master
Running command: git branch -r --no-color
  trunk
Running command: git checkout trunk
Note: checking out 'trunk'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at f4e6268... Changing svn repository in cap files
Running command: git branch -D master
Deleted branch master (was f4e6268).
Running command: git checkout -f -b master
Switched to a new branch 'master'
Running command: git gc
Counting objects: 450, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (368/368), done.
Writing objects: 100% (450/450), done.
Total 450 (delta 63), reused 450 (delta 63)
Run Code Online (Sandbox Code Playgroud)

bkr*_*nan 63

我必须打开.git/config文件并删除svn-remote部分下的所有分支和标签条目,并运行'git svn clone'命令以使此错误消失.显然,如果我多次运行此命令(通常停止并从修订版重新启动),分支/标记条目将添加到配置文件而不是重用,这会导致错误.

  • 我不需要删除所有内容,只需重复以下行:`branches = branches/*:refs/remotes/svn/*`和`tags = tags/*:refs/remotes/svn/tags/*`(保留一个) (10认同)
  • 谢谢,我删除了[svn-remote"svn"]部分下的所有内容.这对我有用.. (2认同)

nem*_*moo 5

要解决您的问题,您必须将导入的远程分支和标签转换为本地分支。

Scott Chacone(PRO GIT)的部分:原始链接:http : //progit.org/book/ch8-2.html :

To move the tags to be proper Git tags, run

$ cp -Rf .git/refs/remotes/tags/* .git/refs/tags/
$ rm -Rf .git/refs/remotes/tags

This takes the references that were remote branches that started with tag/ and makes them real (lightweight) tags.

Next, move the rest of the references under refs/remotes to be local branches:

$ cp -Rf .git/refs/remotes/* .git/refs/heads/
$ rm -Rf .git/refs/remotes
Run Code Online (Sandbox Code Playgroud)

这非常适合我。


jao*_*lho 5

当我遇到相同的错误消息时,我正在关注一些svn到git 指令.运行此命令时发生错误:

git svn clone file:///pathto/repo /pathto/new-git-repo –-no-metadata -A authors.txt -t tags -b branches -T trunk
Run Code Online (Sandbox Code Playgroud)

发生错误后,我编辑了.git/config文件,如下所示:

tags = tags/*:refs/remotes/svn/tags/*
branches = branches/*:refs/remotes/svn/*
Run Code Online (Sandbox Code Playgroud)

- >

tags = tags/*:refs/remotes/svn/tags/*
branches = branches/*:refs/remotes/svn/branches/*
Run Code Online (Sandbox Code Playgroud)

即,我只是将"braches"行格式化为类似于"tags"行.然后我再次运行命令.该过程产生了一个有远程分支的有效git仓库.


Ada*_*ruk 4

您的 Subversion 存储库没有标准的主干/分支/标签结构。使用 --branch、--tag、--trunk 选项指定分支的备用位置。