{"thread":{"id":"13732","subject":"using git-push to backup repo...strange behavior","startedAt":"2008-05-30T12:42:20Z","lastAt":"2008-05-30T13:15:48Z","messageCount":3,"participants":["davetron5000","Teemu Likonen","david@lang.hm"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"78134","messageId":"3a6159d2-e1ff-4aa8-bfeb-806af2bc82c8@8g2000hse.googlegroups.com","threadId":"13732","inReplyTo":null,"subject":"using git-push to backup repo...strange behavior","fromName":"davetron5000","fromEmail":"davetron5000@gmail.com","sentAt":"2008-05-30T12:42:20Z","receivedAt":"2008-05-30T12:42:20Z","isPatch":false,"sender":{"key":"davetron5000@gmail.com","avatar":"https://gravatar.com/avatar/9ec09086e36c4e609dfc23a4582d2c7adf7dc2fb1796f74492d52727efa6ba86?d=mp&s=160"},"body":"at least to me.\n\nI have a git repo locally.  Want to essentially back it up on a remote\nserver using git.\n\nFirst step was tar/gz the repo, scp it to my server and expand it.\nPeriodically throughout the day, I will do a\n\ngit push ssh://my.hostname.com/path/to/git/repo\n\nThere's a few issues:\n\n1. Sometimes it doesn't work, saying a branch is \"non fast forward\".\n--mirror or -f fixes this, but it seems wrong; I make no changes\nremotely and clocks are in sync\n2. --mirror doesn't like git stash, saying 'stash' is a \"funny\nrefname\"\n3. On the remote side, I can find no way to update the working dir\nwith the changes other than git reset --hard.  Do I even need to do\nthis?  I'd like to be able to for automated builds/tests someday.\n4. I made post-update executable, but it never runs (it echos a\nmessage to a file)\n\nI can't help feeling I'm doing everything wrong and just chancing on\nthings working under certain conditions.\n\nDave\n"},{"id":"78135","messageId":"20080530125814.GA8584@mithlond.arda.local","threadId":"13732","inReplyTo":"3a6159d2-e1ff-4aa8-bfeb-806af2bc82c8@8g2000hse.googlegroups.com","subject":"hooks/post-update does not run","fromName":"Teemu Likonen","fromEmail":"tlikonen@iki.fi","sentAt":"2008-05-30T12:58:14Z","receivedAt":"2008-05-30T12:58:14Z","isPatch":false,"sender":{"key":"tlikonen@iki.fi","avatar":null},"body":"davetron5000 wrote (2008-05-30 05:42 -0700):\n\n> There's a few issues:\n[...]\n> 4. I made post-update executable, but it never runs (it echos a\n> message to a file)\n\nI have experienced this too. I never got post-update to do anything\n- even if the repository lies on the same computer and filesystem I'm\npushing from. I wrote about this issue two ago but it didn't get any\nreplies: \n\nhttp://thread.gmane.org/gmane.comp.version-control.git/82351\n"},{"id":"78141","messageId":"alpine.DEB.1.10.0805300611230.4014@asgard.lang.hm","threadId":"13732","inReplyTo":"3a6159d2-e1ff-4aa8-bfeb-806af2bc82c8@8g2000hse.googlegroups.com","subject":"Re: using git-push to backup repo...strange behavior","fromName":"","fromEmail":"david@lang.hm","sentAt":"2008-05-30T13:15:48Z","receivedAt":"2008-05-30T13:15:48Z","isPatch":false,"sender":{"key":"david@lang.hm","avatar":null},"body":"On Fri, 30 May 2008, davetron5000 wrote:\n\n> 3. On the remote side, I can find no way to update the working dir\n> with the changes other than git reset --hard.  Do I even need to do\n> this?  I'd like to be able to for automated builds/tests someday.\n> 4. I made post-update executable, but it never runs (it echos a\n> message to a file)\n\nI just went though this.\n\nin the remote repo I make .git/hooks/post-receive executable, then edited \nit and made the script that it optionally calls excecutable, and \nuncommented it.\n\nI then added git checkout -f  and ran into a problem that was answered \nthis morning by Johan Herland so the final script is\n\n#!/bin/sh\nif [ \"$GIT_DIR\" = \".\" ]; then\n         GIT_DIR=`pwd`\nfi\n\n/usr/share/doc/git-core/contrib/hooks/post-receive-email\ncd ..\n/usr/bin/git checkout -f\n\nDavid Lang\n"}]}