{"thread":{"id":"12711","subject":"git-svn clone on a central server","startedAt":"2008-03-15T19:38:40Z","lastAt":"2008-03-17T15:01:39Z","messageCount":4,"participants":["Bruno Harbulot","Peter Harris"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"72194","messageId":"frh8k1$lc8$1@ger.gmane.org","threadId":"12711","inReplyTo":null,"subject":"git-svn clone on a central server","fromName":"Bruno Harbulot","fromEmail":"bruno.harbulot@manchester.ac.uk","sentAt":"2008-03-15T19:38:40Z","receivedAt":"2008-03-15T19:38:40Z","isPatch":false,"sender":{"key":"bruno.harbulot@manchester.ac.uk","avatar":null},"body":"Hello,\n\nI'm trying to follow example 3 of the git-svn manpage, since I'd like to \nkeep a \"central\" clone of a subversion repository (and rebase it \nregularly) on a server and work on local git repositories based on that \nserver's git repository.\nHowever, I can't get this example to work:\n\n# Do the initial import on a server\n    ssh server \"cd /pub && git-svn clone http://svn.foo.org/project\n# Clone locally - make sure the refs/remotes/ space matches the server\n    mkdir project\n    cd project\n    git-init\n    git remote add origin server:/pub/project\n    git config --add remote.origin.fetch=+refs/remotes/*:refs/remotes/*\n    git fetch\n# Initialize git-svn locally\n    git-svn init http://svn.foo.org/project\n# Pull the latest changes from Subversion\n    git-svn rebase\n\n('--add' doesn't work in git config, but I guess that's not required).\n\nI get this error:\n\n$ git-svn rebase\nfatal: ambiguous argument 'HEAD': unknown revision or path not in the \nworking tree.\nUse '--' to separate paths from revisions\nlog --no-color HEAD: command returned error: 128\n\n\nI've then tried:\n\n$ git checkout origin/master\nwarning: You appear to be on a branch yet to be born.\n[...]\n$ git branch master\n$ git checkout master\n$ git-svn rebase\n\nHowever, this produces this error:\n'Unable to determine upstream SVN information from working tree history'\n\n\nAny idea how to solve this?\n\nBest wishes,\n\n\nBruno.\n"},{"id":"72198","messageId":"eaa105840803151645j5e8ec443v991b9117df343b8f@mail.gmail.com","threadId":"12711","inReplyTo":"frh8k1$lc8$1@ger.gmane.org","subject":"Re: git-svn clone on a central server","fromName":"Peter Harris","fromEmail":"git@peter.is-a-geek.org","sentAt":"2008-03-15T23:45:38Z","receivedAt":"2008-03-15T23:45:38Z","isPatch":false,"sender":{"key":"git@peter.is-a-geek.org","avatar":null},"body":"On Sat, Mar 15, 2008 at 3:38 PM, Bruno Harbulot\n<Bruno.Harbulot@manchester.ac.uk> wrote:\n>  I'm trying to follow example 3 of the git-svn manpage, since I'd like to\n>  keep a \"central\" clone of a subversion repository (and rebase it\n>  regularly) on a server and work on local git repositories based on that\n>  server's git repository.\n...\n>  I get this error:\n>\n>  $ git-svn rebase\n>  fatal: ambiguous argument 'HEAD': unknown revision or path not in the\n>  working tree.\n\nYou have to git reset --hard <branch> to create 'master' based on a\nparticular svn branch, or git-svn won't know what to rebase.\n\nI sent a documentation patch to this list back in February, but it\nappears to have been dropped. I should probably re-send it...\n\nhttp://article.gmane.org/gmane.comp.version-control.git/72954\n\nPeter Harris\n"},{"id":"72219","messageId":"frjbtf$rd0$1@ger.gmane.org","threadId":"12711","inReplyTo":"eaa105840803151645j5e8ec443v991b9117df343b8f@mail.gmail.com","subject":"Re: git-svn clone on a central server","fromName":"Bruno Harbulot","fromEmail":"bruno.harbulot@manchester.ac.uk","sentAt":"2008-03-16T14:47:11Z","receivedAt":"2008-03-16T14:47:11Z","isPatch":false,"sender":{"key":"bruno.harbulot@manchester.ac.uk","avatar":null},"body":"Peter Harris wrote:\n> On Sat, Mar 15, 2008 at 3:38 PM, Bruno Harbulot\n> <Bruno.Harbulot@manchester.ac.uk> wrote:\n>>  I'm trying to follow example 3 of the git-svn manpage, since I'd like to\n>>  keep a \"central\" clone of a subversion repository (and rebase it\n>>  regularly) on a server and work on local git repositories based on that\n>>  server's git repository.\n> ...\n>>  I get this error:\n>>\n>>  $ git-svn rebase\n>>  fatal: ambiguous argument 'HEAD': unknown revision or path not in the\n>>  working tree.\n> \n> You have to git reset --hard <branch> to create 'master' based on a\n> particular svn branch, or git-svn won't know what to rebase.\n> \n> I sent a documentation patch to this list back in February, but it\n> appears to have been dropped. I should probably re-send it...\n> \n> http://article.gmane.org/gmane.comp.version-control.git/72954\n\nThank you. This works. 'git reset --hard' was the key.\n\nI've also managed to get it to work without '-s' (for just a \nsub-directory of the trunk) this way:\n   ssh server \"cd /pub && git svn clone -s \nhttp://svn.foo.org/project/trunk/subproject\"\n   mkdir subproject\n   cd subproject\n   git init\n   git remote add origin server:/pub/subproject\n   git config --add remote.origin.fetch +refs/remotes/*:refs/remotes/*\n   git fetch\n   git svn init http://svn.foo.org/project/trunk/subproject\n# The following line creates a master branch\n   git reset --hard origin/master\n   git svn rebase\n\n\nThe way I'm planning to use this is to create a \"central\" bare \nrepository on the server (by moving the '.git' directory and setting \nbare=true in the config file) that I would like to keep in sync with the \noriginal SVN repository (and also push by own branches).\nI'd like then to pull these changes to my working copies of that central \nrepository. I'm not quite sure how to update this central bare git \nrepository (and then its clones) with the changes in the SVN repository \nupstream. (By the way, I'm not planning to 'dcommit' anything directly, \njust reading from this SVN.) Are there any recommendation on how to \nachieve this?\n\n\nBest wishes,\n\n\nBruno.\n"},{"id":"72288","messageId":"eaa105840803170801p4155f21bpabc828a3be0e4aaa@mail.gmail.com","threadId":"12711","inReplyTo":"frjbtf$rd0$1@ger.gmane.org","subject":"Re: git-svn clone on a central server","fromName":"Peter Harris","fromEmail":"git@peter.is-a-geek.org","sentAt":"2008-03-17T15:01:39Z","receivedAt":"2008-03-17T15:01:39Z","isPatch":false,"sender":{"key":"git@peter.is-a-geek.org","avatar":null},"body":"On Sun, Mar 16, 2008 Bruno Harbulot wrote:\n>  The way I'm planning to use this is to create a \"central\" bare\n>  repository on the server (by moving the '.git' directory and setting\n>  bare=true in the config file) that I would like to keep in sync with the\n>  original SVN repository (and also push by own branches).\n>  I'd like then to pull these changes to my working copies of that central\n>  repository. I'm not quite sure how to update this central bare git\n>  repository (and then its clones) with the changes in the SVN repository\n>  upstream. (By the way, I'm not planning to 'dcommit' anything directly,\n>  just reading from this SVN.) Are there any recommendation on how to\n>  achieve this?\n\nI run \"git svn fetch\" hourly (and \"git gc\" daily) from cron on my\n'server'. My working copies, I just \"git pull\" when I want an update\nas usual.\n\nI also occasionally \"git svn (fetch|rebase|dcommit)\" in my working\ncopies. Just remember to blow away .git/svn after each \"git\n(fetch|pull)\" so that git-svn knows to rebuild the local index. Also,\nyou just have to wait for the central 'server' to run another update\nbefore your next \"git (fetch|pull)\", or it will rewind the state of\nyour svn branches.\n\n(Also note that state can get out of sync if an svn log message or\nauthor changes between the working copy's \"git svn\n(fetch|rebase|dcommit)\" and when the server's cron job triggers -\nbasically never, unless you happen to have coworkers who like to\nammend their svn log messages shortly after making a commit)\n\nI don't push branches to my 'svn fetch' repo (I use a separate repo\nfor that), but I don't see why it would cause a problem.\n\nI'm sure there are other ways to do this.\n\nPeter Harris\n"}]}