tags:

views:

636

answers:

3

I have setup an empty svn on a server and I have been working on locally making commits along the way. Now I wish to commit my repo to an svn server. For this I tried:

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

Git complains that:

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

Since I started on my local computer first, and the repo online is empty, I can't find any info on how to make this work.

A: 

Why don't you just get the data from the once, and then make the initial import on the destination one?

Aif
Because then history is lost.
wnoise
+5  A: 

Here is what I would do:

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

Then in other dir pull the changes locally from your previous dir. Then you should have a git repo that is "connected" via git-svn and you should be able to use dcommit on it.

This might also be a useful read.

tcurdt
I am still getting the same error. It seems even after pulling locally the gir repo was not connected.
Ravi Chhabra
paste your .git/config file ... a git-log would also be useful ... this really isn't a question for SO ... you should go and ask on IRC
tcurdt
+3  A: 

I needed something like this recently and the process is relatively straightforward.

There's good tutorial by Brandon Dimcheff, "Commit a linear git history to subversion", which these steps are based on.

As of Git version 1.6.3 these are the steps:

$ 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

You can do a svn checkout of svn_repository now and see your Git repo.

karmi
This helped a me lot, thanks!
Sietse

related questions