SVN 到 GIT 迁移给出错误,因为没有共同的引用

SVN to GIT migration giving error as No refs in common

我正在尝试将我的项目从 svn 迁移到 git,基于此 url 中给出的步骤:https://docs.microsoft.com/en-us/vsts/articles/perform-migration-from-svn-to-git?view=vsts#push-repository-to-a-bare-git-repository

但是在将存储库推送到裸 git 存储库时,出现以下错误:

C:\Git_Workspace\git_Repo>git push bare
No refs in common and none specified; doing nothing.
Perhaps you should specify a branch such as 'master'.
fatal: The remote end hung up unexpectedly
error: failed to push some refs to '../new_bare_repo.git'

我在这里发现了一个类似的问题 svn to git conversion no refs in common 解决方案没有帮助,但有一条评论建议添加 master,例如:

git push bare master

但它并没有将我的项目推送到裸仓库中,只是创建了主文件。

非常感谢任何能指导我了解这里发生的事情的帮助..

通常不需要将本地 git 仓库推送到本地裸仓库,除非您想将本地裸仓库视为您的远程 git 服务器。

如果您想将远程仓库托管到第 3 方(如 github、bitbucket VSTS git 仓库等),您可以直接推送到远程仓库:

# After migrate svn repo to local git repo by git svn clone command
cd reponame
git remote add origin <remote repo URL>
git push origin --all

有更好的方法可以将 svn 存储库转换为 git。 仅举几例,请参考以下文档:

官方:https://git-scm.com/book/en/v2/Git-and-Other-Systems-Migrating-to-Git 位桶:https://www.atlassian.com/git/tutorials/migrating-overview

它们都指的是同一个过程,但我发现这些文档写得很好。