{"thread":{"id":"6817","subject":"Newbie experience with push over ssh","startedAt":"2007-02-14T14:07:06Z","lastAt":"2007-02-15T15:35:29Z","messageCount":18,"participants":["Matthieu Moy","Matthias Lederhofer","Joseph Wakeling","Bill Lear","Nicolas Pitre","Jeff King","Andreas Ericsson"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"34525","messageId":"vpq64a4bzp1.fsf@olympe.imag.fr","threadId":"6817","inReplyTo":null,"subject":"Newbie experience with push over ssh","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-02-14T14:07:06Z","receivedAt":"2007-02-14T14:07:06Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Hi,\n\nI'm playing a bit with git (still ~ total beginner).\n\nI could create a local repository, commit in it, but then, I tried to\npush it to a remote machine, on which git is installed.\n\nI would have expected \"push\" to do this, but:\n\n$ git push ssh://machine.fr/tmp/foo \nfatal: '/tmp/foo': unable to chdir or not a git archive\nfatal: The remote end hung up unexpectedly\n\nThen, I tried \"clone\":\n\n$ git clone . ssh://machine.fr/tmp/foo\nInitialized empty Git repository in /tmp/foo/ssh:/machine.fr/tmp/foo/.git/\nremote: Generating pack...\nremote: Done counting 3 objects.\nremote: Deltifying 3 objects.\n 100% (3/3) done/3) done\nremote: Total 3 (delta 0), reused 0 (delta 0)\nIndexing 3 objects.\n 100% (3/3) done\n\nGosh, \"push\" seems to know what a URL is, but not \"clone\", which\nconsiders the _file_ ssh:/machine.fr/tmp/foo ...\n\nThen only, I understood that I would have to log onto the remote\nmachine, and mkdir + git init manually. At least, this should be\nmentionned in the git-push man page, but indeed, is there any reason\nwhy git-push could not just create the remote repository? And any\nreason why clone doesn't deal with URLs?\n\nThanks,\n\n-- \nMatthieu\n"},{"id":"34533","messageId":"20070214142731.GA1478@moooo.ath.cx","threadId":"6817","inReplyTo":"vpq64a4bzp1.fsf@olympe.imag.fr","subject":"Re: Newbie experience with push over ssh","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-02-14T14:27:31Z","receivedAt":"2007-02-14T14:27:31Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Matthieu Moy <Matthieu.Moy@imag.fr> wrote:\n> I could create a local repository, commit in it, but then, I tried to\n> push it to a remote machine, on which git is installed.\n> \n> I would have expected \"push\" to do this, but:\n> \n> $ git push ssh://machine.fr/tmp/foo \n> fatal: '/tmp/foo': unable to chdir or not a git archive\n> fatal: The remote end hung up unexpectedly\ngit push is can only push into an existing repository, there seems to\nbe no repository in /tmp/foo on machine.fr.\n\n> Then, I tried \"clone\":\n> \n> $ git clone . ssh://machine.fr/tmp/foo\nThis means: \"clone the repository at . to the directory\nssh://machine.fr/tmp/foo\".  The first parameter is the repository to\nclone from, the second is the directory to put the clone into (this is\noptional).\n\nI don't think there is any way to 'clone to remote'.  You'd have to\nssh to the other machine and clone from there, or you can just create\nan empty repository on the remote host and push the stuff into it.\n"},{"id":"34546","messageId":"45D33485.5020906@webdrake.net","threadId":"6817","inReplyTo":"20070214142731.GA1478@moooo.ath.cx","subject":"Re: Newbie experience with push over ssh","fromName":"Joseph Wakeling","fromEmail":"joseph.wakeling@webdrake.net","sentAt":"2007-02-14T16:10:45Z","receivedAt":"2007-02-14T16:10:45Z","isPatch":false,"sender":{"key":"joseph.wakeling@webdrake.net","avatar":null},"body":"Matthias Lederhofer wrote:\n> I don't think there is any way to 'clone to remote'.  You'd have to\n> ssh to the other machine and clone from there, or you can just create\n> an empty repository on the remote host and push the stuff into it.\n\nI remember coming across the same issue as Matthieu and never got round\nto solving it.  In my case the desire is to upload the code onto a\nremote machine---in particular a cluster where I run simulations.  I\ndon't particularly need that remote code to be in a repo or otherwise,\nsince it's only there to be run, not edited.\n\nAs far as I know I have no way of installing git on that machine.\nPerhaps I could install it locally but I suspect the sysadmin would not\nbe supportive.\n\nSo, is there a way of using git to upload my code to a machine without a\nrepo ready-prepared?\n"},{"id":"34548","messageId":"17875.14305.910866.273778@lisa.zopyra.com","threadId":"6817","inReplyTo":"45D33485.5020906@webdrake.net","subject":"Re: Newbie experience with push over ssh","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-14T16:25:05Z","receivedAt":"2007-02-14T16:25:05Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 14, 2007 at 16:10:45 (+0000) Joseph Wakeling writes:\n>Matthias Lederhofer wrote:\n>> I don't think there is any way to 'clone to remote'.  You'd have to\n>> ssh to the other machine and clone from there, or you can just create\n>> an empty repository on the remote host and push the stuff into it.\n>\n>I remember coming across the same issue as Matthieu and never got round\n>to solving it.  In my case the desire is to upload the code onto a\n>remote machine---in particular a cluster where I run simulations.  I\n>don't particularly need that remote code to be in a repo or otherwise,\n>since it's only there to be run, not edited.\n>\n>As far as I know I have no way of installing git on that machine.\n>Perhaps I could install it locally but I suspect the sysadmin would not\n>be supportive.\n>\n>So, is there a way of using git to upload my code to a machine without a\n>repo ready-prepared?\n\nIf you must ...\n\n% cat ~/.gitconfig\n[alias]\n\tscp !scp\n\trcp !rcp\n% git scp -rp . me@remotehost:/directory\n\n\nBill\n"},{"id":"34551","messageId":"45D33906.2040905@webdrake.net","threadId":"6817","inReplyTo":"17875.14305.910866.273778@lisa.zopyra.com","subject":"Re: Newbie experience with push over ssh","fromName":"Joseph Wakeling","fromEmail":"joseph.wakeling@webdrake.net","sentAt":"2007-02-14T16:29:58Z","receivedAt":"2007-02-14T16:29:58Z","isPatch":false,"sender":{"key":"joseph.wakeling@webdrake.net","avatar":null},"body":"Bill Lear wrote:\n>> So, is there a way of using git to upload my code to a machine without a\n>> repo ready-prepared?\n> \n> If you must ...\n> \n> % cat ~/.gitconfig\n> [alias]\n> \tscp !scp\n> \trcp !rcp\n> % git scp -rp . me@remotehost:/directory\n\nThanks very much.  And (should have asked this first ....) is it\npossible to init a repo remotely, i.e. to use the git on my machine to\ndo init-repo on a directory accessed via ssh or ftp?  And if yes ... to\ndo other git commands similarly remotely?\n\nThe latter would be a slow and painful way of working, I imagine, but\nmight be useful.\n"},{"id":"34553","messageId":"17875.14859.177000.558634@lisa.zopyra.com","threadId":"6817","inReplyTo":"17875.14305.910866.273778@lisa.zopyra.com","subject":"Re: Newbie experience with push over ssh","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-14T16:34:19Z","receivedAt":"2007-02-14T16:34:19Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 14, 2007 at 10:25:05 (-0600) Bill Lear writes:\n>...\n>If you must ...\n>\n>% cat ~/.gitconfig\n>[alias]\n>\tscp !scp\n>\trcp !rcp\n>% git scp -rp . me@remotehost:/directory\n\nActually that was a bit tongue-in-cheek, syntactically incorrect (I\nbelieve missing '='), I'm not actually sure it will work, nor if the\npatch for this actually got in to 1.5.0.  The patch I saw does not\nappear to pass the rest of the command line to the system call, but\nperhaps I'm wrong and someone else can confirm.\n\nIf the patch to do this is reasonable, I would expect the command:\n\n% git scp -rp . me@remotehost:/directory\n\nto expand to:\n\n% scp -rp . me@remotehost:/directory\n\nand if not, I think it should, just as when I have:\n\n[alias]\n\tpub = push /my/repo\n\nand:\n\n% git pub branch:branch\n\nexpands to:\n\n% git push /my/repo branch:branch\n\n\nBill\n"},{"id":"34558","messageId":"vpqfy98660o.fsf@olympe.imag.fr","threadId":"6817","inReplyTo":"17875.14305.910866.273778@lisa.zopyra.com","subject":"Re: Newbie experience with push over ssh","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-02-14T16:47:03Z","receivedAt":"2007-02-14T16:47:03Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Bill Lear <rael@zopyra.com> writes:\n\n> % cat ~/.gitconfig\n> [alias]\n> \tscp !scp\n> \trcp !rcp\n> % git scp -rp . me@remotehost:/directory\n\n[ in this case, I'd prefer using rsync ]\n\nWell, this does not the same as being able to really use git to push.\nFirst, you have no guarantee that the repository will be consistent\nduring the push. I belive the git repository format is relatively safe\nwith this regard since git doesn't rewrite data in-place, so the worst\nthat can happen is probably that someone gets a reference to a\nnot-yet-uploaded object.\n\nBut the real advantage of using the version control system to upload\nis to avoid the case of \n\n$ cd /path/to/dumb/project\n$ rsync ./ path:to/very/important/project/\n\nsince rsync/scp are not designed to look at the content of the\ndestination before overriding it. Using git, I believe such\nmiss-manipulation could lead to having irrelevant data in a\nrepository, but not to data-loss.\n\n-- \nMatthieu\n"},{"id":"34560","messageId":"45D33D53.6040209@webdrake.net","threadId":"6817","inReplyTo":"17875.14859.177000.558634@lisa.zopyra.com","subject":"Re: Newbie experience with push over ssh","fromName":"Joseph Wakeling","fromEmail":"joseph.wakeling@webdrake.net","sentAt":"2007-02-14T16:48:19Z","receivedAt":"2007-02-14T16:48:19Z","isPatch":false,"sender":{"key":"joseph.wakeling@webdrake.net","avatar":null},"body":"Bill Lear wrote:\n> Actually that was a bit tongue-in-cheek, syntactically incorrect (I\n> believe missing '='), I'm not actually sure it will work, nor if the\n> patch for this actually got in to 1.5.0.  The patch I saw does not\n> appear to pass the rest of the command line to the system call, but\n> perhaps I'm wrong and someone else can confirm.\n\nCan you explain in detail exactly what your .gitconfig modifications are\ndoing?  If I understand right, is there any particular point in\nbothering with these aliases, is it not just equivalent to using scp by\nitself?\n"},{"id":"34563","messageId":"17875.16088.2855.792984@lisa.zopyra.com","threadId":"6817","inReplyTo":"45D33D53.6040209@webdrake.net","subject":"Re: Newbie experience with push over ssh","fromName":"Bill Lear","fromEmail":"rael@zopyra.com","sentAt":"2007-02-14T16:54:48Z","receivedAt":"2007-02-14T16:54:48Z","isPatch":false,"sender":{"key":"rael@zopyra.com","avatar":"https://gravatar.com/avatar/c4f2d2790ca3828d3b4e7dfebabf61d2fe94fd82fa49cdac2a5295dd2d46a874?d=mp&s=160"},"body":"On Wednesday, February 14, 2007 at 16:48:19 (+0000) Joseph Wakeling writes:\n>...\n>Can you explain in detail exactly what your .gitconfig modifications are\n>doing?  If I understand right, is there any particular point in\n>bothering with these aliases, is it not just equivalent to using scp by\n>itself?\n\nWell, that was my tongue-in-cheek bit.  My intent was to just say \"Why\nnot simply use scp/rcp/rsync, whatever?\", as that seemed to be what\nyou were asking git to do.  But, if you had to do it, I thought you\ncould, using the aliases I outlined (and, as it turns out, I may have\neven been wrong about that).\n\n\nBill\n"},{"id":"34564","messageId":"vpqbqjw65kj.fsf@olympe.imag.fr","threadId":"6817","inReplyTo":"45D33D53.6040209@webdrake.net","subject":"Re: Newbie experience with push over ssh","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2007-02-14T16:56:44Z","receivedAt":"2007-02-14T16:56:44Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Joseph Wakeling <joseph.wakeling@webdrake.net> writes:\n\n> If I understand right, is there any particular point in\n> bothering with these aliases,\n\nNot any. The joke was just \"if you insist in having git at the\nbeginning of the command line, ...\".\n\n-- \nMatthieu\n"},{"id":"34568","messageId":"45D3412B.9010200@webdrake.net","threadId":"6817","inReplyTo":"vpqbqjw65kj.fsf@olympe.imag.fr","subject":"Re: Newbie experience with push over ssh","fromName":"Joseph Wakeling","fromEmail":"joseph.wakeling@webdrake.net","sentAt":"2007-02-14T17:04:43Z","receivedAt":"2007-02-14T17:04:43Z","isPatch":false,"sender":{"key":"joseph.wakeling@webdrake.net","avatar":null},"body":"Matthieu Moy wrote:\n> Not any. The joke was just \"if you insist in having git at the\n> beginning of the command line, ...\".\n\nForgive me, I have a BAAD cold today and many things are going over my\nhead .... :-)\n\nThat is frustrating, though, that I can't push/upload code in the same\nway as I can with bzr.  Unless I _can_ init-repo on the remote machine\nwith the git on my own .... ?\n"},{"id":"34580","messageId":"Pine.LNX.4.64.0702141237400.1757@xanadu.home","threadId":"6817","inReplyTo":"45D3412B.9010200@webdrake.net","subject":"Re: Newbie experience with push over ssh","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-14T17:38:57Z","receivedAt":"2007-02-14T17:38:57Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 14 Feb 2007, Joseph Wakeling wrote:\n\n> That is frustrating, though, that I can't push/upload code in the same\n> way as I can with bzr.  Unless I _can_ init-repo on the remote machine\n> with the git on my own .... ?\n\nWhat would be the point if you don't have GIT on the remote system?\n\nJust use rsync or scp to copy your code over and be happy.\n\n\nNicolas\n"},{"id":"34585","messageId":"45D34B17.70602@webdrake.net","threadId":"6817","inReplyTo":"Pine.LNX.4.64.0702141237400.1757@xanadu.home","subject":"Re: Newbie experience with push over ssh","fromName":"Joseph Wakeling","fromEmail":"joseph.wakeling@webdrake.net","sentAt":"2007-02-14T17:47:03Z","receivedAt":"2007-02-14T17:47:03Z","isPatch":false,"sender":{"key":"joseph.wakeling@webdrake.net","avatar":null},"body":"Nicolas Pitre wrote:\n> What would be the point if you don't have GIT on the remote system?\n> \n> Just use rsync or scp to copy your code over and be happy.\n\nFor one thing, I might be making small changes or have unversioned files\nin my local directory that I don't want to copy.  I only want to push\nacross the latest code in the branch.\n"},{"id":"34597","messageId":"20070214175140.GA24684@cc.gatech.edu","threadId":"6817","inReplyTo":"45D34B17.70602@webdrake.net","subject":"Re: Newbie experience with push over ssh","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2007-02-14T17:51:40Z","receivedAt":"2007-02-14T17:51:40Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 14, 2007 at 05:47:03PM +0000, Joseph Wakeling wrote:\n\n> For one thing, I might be making small changes or have unversioned files\n> in my local directory that I don't want to copy.  I only want to push\n> across the latest code in the branch.\n\nrsync will efficiently push small changes. Just feed it input from git's\nlist of versioned files:\n\ngit ls-files -z | rsync -a --files-from=- -0 . host:/path/to/dest\n\n-Peff\n"},{"id":"34586","messageId":"20070214175219.GA7082@moooo.ath.cx","threadId":"6817","inReplyTo":"45D33485.5020906@webdrake.net","subject":"Re: Newbie experience with push over ssh","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2007-02-14T17:52:19Z","receivedAt":"2007-02-14T17:52:19Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Joseph Wakeling <joseph.wakeling@webdrake.net> wrote:\n> I remember coming across the same issue as Matthieu and never got round\n> to solving it.  In my case the desire is to upload the code onto a\n> remote machine---in particular a cluster where I run simulations.  I\n> don't particularly need that remote code to be in a repo or otherwise,\n> since it's only there to be run, not edited.\n\ngit archive --format=tar HEAD | ssh remote 'cd /some/where;tar xvf -'\n\nYou could put this in a shell script which takes the remote hostname,\npath and optionally the revision to send..\n"},{"id":"34590","messageId":"45D34E57.5050004@webdrake.net","threadId":"6817","inReplyTo":"20070214175219.GA7082@moooo.ath.cx","subject":"Re: Newbie experience with push over ssh","fromName":"Joseph Wakeling","fromEmail":"joseph.wakeling@webdrake.net","sentAt":"2007-02-14T18:00:55Z","receivedAt":"2007-02-14T18:00:55Z","isPatch":false,"sender":{"key":"joseph.wakeling@webdrake.net","avatar":null},"body":"Matthias Lederhofer wrote:\n> Joseph Wakeling <joseph.wakeling@webdrake.net> wrote:\n>> I remember coming across the same issue as Matthieu and never got round\n>> to solving it.  In my case the desire is to upload the code onto a\n>> remote machine---in particular a cluster where I run simulations.  I\n>> don't particularly need that remote code to be in a repo or otherwise,\n>> since it's only there to be run, not edited.\n> \n> git archive --format=tar HEAD | ssh remote 'cd /some/where;tar xvf -'\n> \n> You could put this in a shell script which takes the remote hostname,\n> path and optionally the revision to send..\n\nAaahhh, that looks quite an elegant solution.  Thank you very much!\n"},{"id":"34593","messageId":"Pine.LNX.4.64.0702141253520.1757@xanadu.home","threadId":"6817","inReplyTo":"45D34B17.70602@webdrake.net","subject":"Re: Newbie experience with push over ssh","fromName":"Nicolas Pitre","fromEmail":"nico@cam.org","sentAt":"2007-02-14T18:03:11Z","receivedAt":"2007-02-14T18:03:11Z","isPatch":false,"sender":{"key":"nico@fluxnic.net","avatar":"https://avatars.githubusercontent.com/u/702790?v=4"},"body":"On Wed, 14 Feb 2007, Joseph Wakeling wrote:\n\n> Nicolas Pitre wrote:\n> > What would be the point if you don't have GIT on the remote system?\n> > \n> > Just use rsync or scp to copy your code over and be happy.\n> \n> For one thing, I might be making small changes or have unversioned files\n> in my local directory that I don't want to copy.  I only want to push\n> across the latest code in the branch.\n\nTry this then:\n\n  git archive --format=tar <branch_name> | ssh <remote_machine> tar -xf -\n\nYou can also use the --prefix= argument to git-archive in order to \nspecify a subdirectory on the remote machine.\n\n\nNicolas\n"},{"id":"34714","messageId":"45D47DC1.6020401@op5.se","threadId":"6817","inReplyTo":"17875.14305.910866.273778@lisa.zopyra.com","subject":"Re: Newbie experience with push over ssh","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2007-02-15T15:35:29Z","receivedAt":"2007-02-15T15:35:29Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Bill Lear wrote:\n> On Wednesday, February 14, 2007 at 16:10:45 (+0000) Joseph Wakeling writes:\n>> Matthias Lederhofer wrote:\n>>> I don't think there is any way to 'clone to remote'.  You'd have to\n>>> ssh to the other machine and clone from there, or you can just create\n>>> an empty repository on the remote host and push the stuff into it.\n>> I remember coming across the same issue as Matthieu and never got round\n>> to solving it.  In my case the desire is to upload the code onto a\n>> remote machine---in particular a cluster where I run simulations.  I\n>> don't particularly need that remote code to be in a repo or otherwise,\n>> since it's only there to be run, not edited.\n>>\n>> As far as I know I have no way of installing git on that machine.\n>> Perhaps I could install it locally but I suspect the sysadmin would not\n>> be supportive.\n>>\n>> So, is there a way of using git to upload my code to a machine without a\n>> repo ready-prepared?\n> \n> If you must ...\n> \n> % cat ~/.gitconfig\n> [alias]\n> \tscp !scp\n> \trcp !rcp\n> % git scp -rp . me@remotehost:/directory\n>\n\n:-)\n\nPerhaps a better solution would be to do\n\ngit archive --format=tar --prefix=project/ | bzip2 -f9 | \\\n\tssh user@remote -C \"cat > project.tar.bz2\"\n\nThen unpack and build as usual on the remote end. Works a treat and is\ncurrently the gist of the only line in my \"push-to-web\" script (the rest\nof it just extends the command to run to also unpack the tarball).\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"}]}