{"thread":{"id":"11865","subject":"New to git: sorry for obvious question.","startedAt":"2008-02-04T09:56:00Z","lastAt":"2008-02-04T14:17:51Z","messageCount":8,"participants":["Paul Gardiner","Matthieu Moy","Boaz Harrosh","Luciano Rocha"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"67339","messageId":"47A6E130.7090909@glidos.net","threadId":"11865","inReplyTo":null,"subject":"New to git: sorry for obvious question.","fromName":"Paul Gardiner","fromEmail":"osronline@glidos.net","sentAt":"2008-02-04T09:56:00Z","receivedAt":"2008-02-04T09:56:00Z","isPatch":false,"sender":{"key":"osronline@glidos.net","avatar":null},"body":"Hi,\n\nI've moved a project from CVS on sourceforge to git on repo.or.cz.  I\nwant a local mirror on my own home server, so that it appears amongst\nthe projects shown by my own gitweb set up, and so it gets caught by\nmy backup system.  I've created the mirror with\n\n   git clone --bare <remote-url> <local-dir>\n\nand that seems fine.  But how do I now keep it up to date.  I was\nguessing a cron job doing some sort of git pull, but pull doesn't\nlook to work on --bare proj.git type repositories.\n\nAny help most apprecieated.\n\nCheers,\n\tPaul.\n"},{"id":"67343","messageId":"vpq4pcp6moq.fsf@bauges.imag.fr","threadId":"11865","inReplyTo":"47A6E130.7090909@glidos.net","subject":"Re: New to git: sorry for obvious question.","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@imag.fr","sentAt":"2008-02-04T10:27:49Z","receivedAt":"2008-02-04T10:27:49Z","isPatch":false,"sender":{"key":"git@matthieu-moy.fr","avatar":"https://avatars.githubusercontent.com/u/14709?v=4"},"body":"Paul Gardiner <osronline@glidos.net> writes:\n\n> Hi,\n>\n> I've moved a project from CVS on sourceforge to git on repo.or.cz.  I\n> want a local mirror on my own home server, so that it appears amongst\n> the projects shown by my own gitweb set up, and so it gets caught by\n> my backup system.  I've created the mirror with\n>\n>   git clone --bare <remote-url> <local-dir>\n>\n> and that seems fine.  But how do I now keep it up to date.  I was\n> guessing a cron job doing some sort of git pull, but pull doesn't\n> look to work on --bare proj.git type repositories.\n\nYou probably want \"git fetch\". Actually, \"git pull\" does a fetch first\n(get the remote revisions that you don't have), and then a merge with\nyour working tree.\n\n-- \nMatthieu\n"},{"id":"67344","messageId":"47A6EBBD.9060500@glidos.net","threadId":"11865","inReplyTo":"vpq4pcp6moq.fsf@bauges.imag.fr","subject":"Re: New to git: sorry for obvious question.","fromName":"Paul Gardiner","fromEmail":"osronline@glidos.net","sentAt":"2008-02-04T10:41:01Z","receivedAt":"2008-02-04T10:41:01Z","isPatch":false,"sender":{"key":"osronline@glidos.net","avatar":null},"body":"Matthieu Moy wrote:\n> Paul Gardiner <osronline@glidos.net> writes:\n> \n>> Hi,\n>>\n>> I've moved a project from CVS on sourceforge to git on repo.or.cz.  I\n>> want a local mirror on my own home server, so that it appears amongst\n>> the projects shown by my own gitweb set up, and so it gets caught by\n>> my backup system.  I've created the mirror with\n>>\n>>   git clone --bare <remote-url> <local-dir>\n>>\n>> and that seems fine.  But how do I now keep it up to date.  I was\n>> guessing a cron job doing some sort of git pull, but pull doesn't\n>> look to work on --bare proj.git type repositories.\n> \n> You probably want \"git fetch\". Actually, \"git pull\" does a fetch first\n> (get the remote revisions that you don't have), and then a merge with\n> your working tree.\n\nYeah, that's what I thought, but it doesn't seem to work with --bare\nrepositories that are of the form proj.git, rather than having a dir \nproj containing checkout files and a .git folder. Both pull and fetch\nsay that it isn't a git repository (although I can view it under gitweb,\nand I can clone and pule from it).\n"},{"id":"67346","messageId":"20080204105006.GA15855@bit.office.eurotux.com","threadId":"11865","inReplyTo":"47A6E130.7090909@glidos.net","subject":"Re: New to git: sorry for obvious question.","fromName":"Luciano Rocha","fromEmail":"luciano@eurotux.com","sentAt":"2008-02-04T10:50:07Z","receivedAt":"2008-02-04T10:50:07Z","isPatch":false,"sender":{"key":"luciano@eurotux.com","avatar":null},"body":"On Mon, Feb 04, 2008 at 09:56:00AM +0000, Paul Gardiner wrote:\n>  Hi,\n> \n>  I've moved a project from CVS on sourceforge to git on repo.or.cz.  I\n>  want a local mirror on my own home server, so that it appears amongst\n>  the projects shown by my own gitweb set up, and so it gets caught by\n>  my backup system.  I've created the mirror with\n> \n>    git clone --bare <remote-url> <local-dir>\n> \n>  and that seems fine.  But how do I now keep it up to date.  I was\n>  guessing a cron job doing some sort of git pull, but pull doesn't\n>  look to work on --bare proj.git type repositories.\n\nYou want git fetch. Git pull also updates the working copy, which you\ndon't have.\n\nAlso, git clone --bare doesn't set up the origin configuration, and I\nhave to do it by hand:\n  git config remote.origin.url \"$url\"\n  git config remote.origin.fetch \"+refs/heads/*:refs/heads/*\"\n\nAs for keeping clones up to date, I include a script I use daily for\nthat purpose.\n\n-- \nLuciano Rocha <luciano@eurotux.com>\nEurotux Informática, S.A. <http://www.eurotux.com/>\n\n\n#!/bin/bash\n\ncd /media/stuff/src || exit 1\n\nlockf=/tmp/.uprepo.lock\nlockfile -60 -l 36000 -r 20 $lockf || exit 1\n\nTL=$((20*60))\n\nrunning()\n{\n\tkill -0 $* &> /dev/null\n}\n\ntl()\n{\n\tlocal max=$(($1+SECONDS))\n\tshift\n\texec \"$@\" &\n\twhile running $! &> /dev/null && [ $max -ge $SECONDS ]; do sleep 1; done\n\tif running $!; then\n\t\tkill $! &> /dev/null\n\t\tsleep 1\n\t\tkill -9 $! &> /dev/null\n\tfi\n}\n\ntrap \"rm -f $lockf\" EXIT\n\nshopt -s dotglob\n\nfor i in *.git */*.git; do\n\t[ -h \"$i\" ] && continue\n\t[ -d \"$i\" ] || continue\n\n\td=\"${i%/.git}\"\n\n\techo $d\n\tif [ \"$d\" = \"$i\" ]; then\n\t\t(cd \"$d\" && tl $TL git fetch) 2>&1 | nocr\n\telif [ -d \"$i/svn\" ]; then\n\t\t(cd \"$d\" && tl $TL git svn fetch) 2>&1 | nocr\n\telif [ -e \"$d/.cvsurl\" ]; then\n\t\t(cd \"$d\" && tl $TL git cvsimport $(<.cvsurl)) 2>&1 | nocr\n\telif [ -e \"$d/.svnurl\" ]; then\n\t\t(cd \"$d\" && tl $TL git svnimport -r $(<.svnurl)) 2>&1 | nocr\n\telse\n\t\t(cd \"$d\" && tl $TL git pull) 2>&1 | nocr\n\tfi\ndone\n\nfor i in */*.hg */*/*.hg; do\n\t[ -h \"$i\" ] && continue\n\t[ -d \"$i\" ] || continue\n\n\td=\"${i%/.hg}\"\n\n\techo $d\n\t(cd \"$d\" && tl $TL hg pull)\ndone\n\nfor i in */*_darcs; do\n\t[ -h \"$i\" ] && continue\n\t[ -d \"$i\" ] || continue\n\n\td=\"${i%/_darcs}\"\n\n\techo $d\n\t(cd \"$d\" && tl $TL darcs pull -aq)\ndone\n\nfor i in */.svn; do\n\t[ -h \"$i\" ] && continue\n\t[ -d \"$i\" ] || continue\n\n\td=\"${i%/.svn}\"\n\n\techo $d\n\t(cd \"$d\" && tl $TL svn up -q)\ndone\n\nfor i in */CVS; do\n\t[ -h \"$i\" ] && continue\n\t[ -d \"$i\" ] || continue\n\n\td=\"${i%/CVS}\"\n\n\techo $d\n\t(cd \"$d\" && tl $TL cvs -Q -z3 up -P)\ndone\n\n\n#!/usr/bin/perl\nuse warnings;\nuse strict;\n\n-t && exec \"/bin/cat\";\n\nundef $/;\n\nmy $in = <>;\n\n$in =~ s/^.*\\r(?!\\n)//gm;\n\nprint $in;\n"},{"id":"67345","messageId":"47A6EE2B.7050500@panasas.com","threadId":"11865","inReplyTo":"47A6EBBD.9060500@glidos.net","subject":"Re: New to git: sorry for obvious question.","fromName":"Boaz Harrosh","fromEmail":"bharrosh@panasas.com","sentAt":"2008-02-04T10:51:23Z","receivedAt":"2008-02-04T10:51:23Z","isPatch":false,"sender":{"key":"bharrosh@panasas.com","avatar":"https://gravatar.com/avatar/347e426f8ca0409f6891ceeefd4c3c2d8769608382323057efeaa362b4c3dbf3?d=mp&s=160"},"body":"On Mon, Feb 04 2008 at 12:41 +0200, Paul Gardiner <osronline@glidos.net> wrote:\n> Matthieu Moy wrote:\n>> Paul Gardiner <osronline@glidos.net> writes:\n>>\n>>> Hi,\n>>>\n>>> I've moved a project from CVS on sourceforge to git on repo.or.cz.  I\n>>> want a local mirror on my own home server, so that it appears amongst\n>>> the projects shown by my own gitweb set up, and so it gets caught by\n>>> my backup system.  I've created the mirror with\n>>>\n>>>   git clone --bare <remote-url> <local-dir>\n>>>\n>>> and that seems fine.  But how do I now keep it up to date.  I was\n>>> guessing a cron job doing some sort of git pull, but pull doesn't\n>>> look to work on --bare proj.git type repositories.\n>> You probably want \"git fetch\". Actually, \"git pull\" does a fetch first\n>> (get the remote revisions that you don't have), and then a merge with\n>> your working tree.\n> \n> Yeah, that's what I thought, but it doesn't seem to work with --bare\n> repositories that are of the form proj.git, rather than having a dir \n> proj containing checkout files and a .git folder. Both pull and fetch\n> say that it isn't a git repository (although I can view it under gitweb,\n> and I can clone and pule from it).\n> \n> \ngit-remote update is your friend then\n\nBoaz\n"},{"id":"67351","messageId":"47A6FF6B.1000103@glidos.net","threadId":"11865","inReplyTo":"20080204105006.GA15855@bit.office.eurotux.com","subject":"Re: New to git: sorry for obvious question.","fromName":"Paul Gardiner","fromEmail":"osronline@glidos.net","sentAt":"2008-02-04T12:04:59Z","receivedAt":"2008-02-04T12:04:59Z","isPatch":false,"sender":{"key":"osronline@glidos.net","avatar":null},"body":"Luciano Rocha wrote:\n> On Mon, Feb 04, 2008 at 09:56:00AM +0000, Paul Gardiner wrote:\n>>  Hi,\n>>\n>>  I've moved a project from CVS on sourceforge to git on repo.or.cz.  I\n>>  want a local mirror on my own home server, so that it appears amongst\n>>  the projects shown by my own gitweb set up, and so it gets caught by\n>>  my backup system.  I've created the mirror with\n>>\n>>    git clone --bare <remote-url> <local-dir>\n>>\n>>  and that seems fine.  But how do I now keep it up to date.  I was\n>>  guessing a cron job doing some sort of git pull, but pull doesn't\n>>  look to work on --bare proj.git type repositories.\n> \n> You want git fetch. Git pull also updates the working copy, which you\n> don't have.\n> \n> Also, git clone --bare doesn't set up the origin configuration, and I\n> have to do it by hand:\n>   git config remote.origin.url \"$url\"\n>   git config remote.origin.fetch \"+refs/heads/*:refs/heads/*\"\n\nBrilliant!! That works.\n\nSo why wouldn't git-fetch work when, instead of setting up the origin\nconfig, I put the url and refspec on the commandline? - not that it\nmatters, just interested.\n\nCheers,\n\tPaul.\n"},{"id":"67358","messageId":"47A70ECE.2040606@panasas.com","threadId":"11865","inReplyTo":"20080204105006.GA15855@bit.office.eurotux.com","subject":"Re: New to git: sorry for obvious question.","fromName":"Boaz Harrosh","fromEmail":"bharrosh@panasas.com","sentAt":"2008-02-04T13:10:38Z","receivedAt":"2008-02-04T13:10:38Z","isPatch":false,"sender":{"key":"bharrosh@panasas.com","avatar":"https://gravatar.com/avatar/347e426f8ca0409f6891ceeefd4c3c2d8769608382323057efeaa362b4c3dbf3?d=mp&s=160"},"body":"On Mon, Feb 04 2008 at 12:50 +0200, Luciano Rocha <luciano@eurotux.com> wrote:\n> On Mon, Feb 04, 2008 at 09:56:00AM +0000, Paul Gardiner wrote:\n>>  Hi,\n>>\n>>  I've moved a project from CVS on sourceforge to git on repo.or.cz.  I\n>>  want a local mirror on my own home server, so that it appears amongst\n>>  the projects shown by my own gitweb set up, and so it gets caught by\n>>  my backup system.  I've created the mirror with\n>>\n>>    git clone --bare <remote-url> <local-dir>\n>>\n>>  and that seems fine.  But how do I now keep it up to date.  I was\n>>  guessing a cron job doing some sort of git pull, but pull doesn't\n>>  look to work on --bare proj.git type repositories.\n> \n> You want git fetch. Git pull also updates the working copy, which you\n> don't have.\n> \n> Also, git clone --bare doesn't set up the origin configuration, and I\n> have to do it by hand:\n>   git config remote.origin.url \"$url\"\n>   git config remote.origin.fetch \"+refs/heads/*:refs/heads/*\"\n> \nBetter do \"git-remote add URL\" then manual addition as above.\n\nBoaz\n"},{"id":"67363","messageId":"47A71E8F.6030104@glidos.net","threadId":"11865","inReplyTo":"47A70ECE.2040606@panasas.com","subject":"Re: New to git: sorry for obvious question.","fromName":"Paul Gardiner","fromEmail":"osronline@glidos.net","sentAt":"2008-02-04T14:17:51Z","receivedAt":"2008-02-04T14:17:51Z","isPatch":false,"sender":{"key":"osronline@glidos.net","avatar":null},"body":"Boaz Harrosh wrote:\n> On Mon, Feb 04 2008 at 12:50 +0200, Luciano Rocha <luciano@eurotux.com> wrote:\n>> Also, git clone --bare doesn't set up the origin configuration, and I\n>> have to do it by hand:\n>>   git config remote.origin.url \"$url\"\n>>   git config remote.origin.fetch \"+refs/heads/*:refs/heads/*\"\n>>\n> Better do \"git-remote add URL\" then manual addition as above.\n\nWould that be git-remote add --mirror origin URL?\n"}]}