14

我在服务器上设置了一个空的 svn,并且一直在本地进行提交。现在我希望将我的 repo 提交到 svn 服务器。为此,我尝试了:

git-svn checkout http://remote.svn.server.com
git-svn dcommit

Git抱怨说:

Use of uninitialized value in concatenation (.) or string at /usr/bin/git-svn line 411.
Committing to  ...
Unable to determine upstream SVN information from HEAD history

由于我首先在本地计算机上开始,并且在线回购是空的,所以我找不到任何有关如何使这项工作的信息。

4

2 回答 2

29

我最近需要这样的东西,这个过程相对简单。

Brandon Dimcheff 有一个很好的教程,“Commit a linear git history to subversion”(替换旧的断开链接),这些步骤都基于该教程。

从 Git 版本 1.6.3 开始,这些是步骤:

$ svnadmin create svn_repository
$ svn mkdir -m "Initial setup" file:///full/path/to/svn_repository/trunk

$ mkdir gitrepo && cd gitrepo
$ git init
$ echo 'Hello from Git' > file.txt
$ git add file.txt
$ git commit -m "Hello from Git"

$ git svn init --trunk=trunk file:///full/path/to/svn_repository/
$ git svn fetch

$ git branch -a # Lists remotes/trunk

$ git rebase --onto remotes/trunk --root master
# => Applying: Hello from Git etc.

$ git svn dcommit
# => Committing to ... Committed r2 ... etc

您现在可以执行svn checkoutsvn_repository 并查看您的 Git 存储库。

于 2009-06-11T15:18:51.843 回答
6

这是我要做的:

git-svn clone http://remote.svn.server.com otherdir

然后在其他目录中从您以前的目录中提取本地更改。然后你应该有一个通过 git-svn “连接”的 git repo,你应该能够在它上面使用 dcommit。

也可能是一个有用的阅读。

于 2009-01-20T00:21:28.030 回答