0

我目前正在将一个 svn 源代码控制项目迁移到 Git (BitBucket) 中。我已按照Atlassian 的指南进行操作,几乎走到了尽头,但在运行命令git push -u origin --all时遇到以下错误:

No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
Everything up-to-date.

我相信这是因为 SVN 布局不是标准布局。我不得不像这样指定主干、分支和标签:

git svn clone --trunk=/main --branches=/branches/Sprints/Iteration_1 --branches=/branches/Sprints/Iteration_2 --tags=/tags --authors-file=authors.txt svn://svn-project/projExample projExample

但我不知道如何继续并将回购推送到 BitBucket。任何帮助将不胜感激!

还值得注意的是,我尝试了命令git push origin master并收到以下错误:

error: src refspec master does not match any.
error: failed to push refs to '[my bitbucket origin]'.

我发现的上一个问题的一个例子是here。但这似乎没有帮助。也许我做错了什么?

以下是为了运行以获取上述初始错误的命令:

  1. java -jar /svn-migration-scripts.jar 验证
  2. java -jar /svn-migration-scripts.jar authors svn://svn-project/projExample > authors.txt
  3. 编辑 authors.txt 文件以匹配所有当前用户名和电子邮件。
  4. git svn clone --trunk=/main --branches=/branches/Sprints/Iteration_1 --branches=/branches/Sprints/Iteration_2 --tags=/tags --authors-file=authors.txt svn://svn-项目/projExample projExample
  5. java -DFile.encoding=utf-8 -jar /svn-migration-scripts.jar clean-git --force
  6. git svn 获取
  7. java -Dfile.encoding=utf-8 -jar /svn-migration-scripts.jar sync-rebase
  8. java -Dfile.encoding=utf-8 -jar /svn-migration-scripts.jar clean-git --force
  9. git 远程添加源https://example@bitbucket.com/projExample.git
  10. git push -u origin --all
  11. 什么都没发生。
4

1 回答 1

0

After a lot of trial and error I have come to the conclusion that the SVN structure used here was just far too complicated. I updated the command to

git svn clone --trunk=main --branches=branches/*/* --tags=tags/* --authors-file=authors.txt svn://svn-project/projExample projExample

Which solved the issue but resulted in the command taking 7 days to run! This shows that the structure was far too complicated!

As a result of this I decided to use the svn branch containing the latest code as the trunk which successfully added the history but did not create the required branches. I decided that this was good enough as the command would run within 2 hours. The command I went for was more like this:

git svn clone --trunk=branches/Sprints/Iteration_2 --authors-file=authors.txt svn://svn-project/projExample projExample.

If I was advising someone else on this I would say to go straight for the command above as it is quick and does the job!

As an extra below are the commands needed to sync SVN to the Git repo. basically you need to merge origin/trunk and master and then push

git svn fetch
git merge origin/trunk
git push origin master
于 2017-01-18T15:38:59.423 回答