* New to git: sorry for obvious question.
@ 2008-02-04 9:56 Paul Gardiner
2008-02-04 10:27 ` Matthieu Moy
2008-02-04 10:50 ` Luciano Rocha
0 siblings, 2 replies; 8+ messages in thread
From: Paul Gardiner @ 2008-02-04 9:56 UTC (permalink / raw)
To: git
Hi,
I've moved a project from CVS on sourceforge to git on repo.or.cz. I
want a local mirror on my own home server, so that it appears amongst
the projects shown by my own gitweb set up, and so it gets caught by
my backup system. I've created the mirror with
git clone --bare <remote-url> <local-dir>
and that seems fine. But how do I now keep it up to date. I was
guessing a cron job doing some sort of git pull, but pull doesn't
look to work on --bare proj.git type repositories.
Any help most apprecieated.
Cheers,
Paul.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: New to git: sorry for obvious question.
2008-02-04 9:56 New to git: sorry for obvious question Paul Gardiner
@ 2008-02-04 10:27 ` Matthieu Moy
2008-02-04 10:41 ` Paul Gardiner
2008-02-04 10:50 ` Luciano Rocha
1 sibling, 1 reply; 8+ messages in thread
From: Matthieu Moy @ 2008-02-04 10:27 UTC (permalink / raw)
To: Paul Gardiner; +Cc: git
Paul Gardiner <osronline@glidos.net> writes:
> Hi,
>
> I've moved a project from CVS on sourceforge to git on repo.or.cz. I
> want a local mirror on my own home server, so that it appears amongst
> the projects shown by my own gitweb set up, and so it gets caught by
> my backup system. I've created the mirror with
>
> git clone --bare <remote-url> <local-dir>
>
> and that seems fine. But how do I now keep it up to date. I was
> guessing a cron job doing some sort of git pull, but pull doesn't
> look to work on --bare proj.git type repositories.
You probably want "git fetch". Actually, "git pull" does a fetch first
(get the remote revisions that you don't have), and then a merge with
your working tree.
--
Matthieu
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: New to git: sorry for obvious question.
2008-02-04 10:27 ` Matthieu Moy
@ 2008-02-04 10:41 ` Paul Gardiner
2008-02-04 10:51 ` Boaz Harrosh
0 siblings, 1 reply; 8+ messages in thread
From: Paul Gardiner @ 2008-02-04 10:41 UTC (permalink / raw)
To: git
Matthieu Moy wrote:
> Paul Gardiner <osronline@glidos.net> writes:
>
>> Hi,
>>
>> I've moved a project from CVS on sourceforge to git on repo.or.cz. I
>> want a local mirror on my own home server, so that it appears amongst
>> the projects shown by my own gitweb set up, and so it gets caught by
>> my backup system. I've created the mirror with
>>
>> git clone --bare <remote-url> <local-dir>
>>
>> and that seems fine. But how do I now keep it up to date. I was
>> guessing a cron job doing some sort of git pull, but pull doesn't
>> look to work on --bare proj.git type repositories.
>
> You probably want "git fetch". Actually, "git pull" does a fetch first
> (get the remote revisions that you don't have), and then a merge with
> your working tree.
Yeah, that's what I thought, but it doesn't seem to work with --bare
repositories that are of the form proj.git, rather than having a dir
proj containing checkout files and a .git folder. Both pull and fetch
say that it isn't a git repository (although I can view it under gitweb,
and I can clone and pule from it).
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: New to git: sorry for obvious question.
2008-02-04 10:41 ` Paul Gardiner
@ 2008-02-04 10:51 ` Boaz Harrosh
0 siblings, 0 replies; 8+ messages in thread
From: Boaz Harrosh @ 2008-02-04 10:51 UTC (permalink / raw)
To: Paul Gardiner; +Cc: git
On Mon, Feb 04 2008 at 12:41 +0200, Paul Gardiner <osronline@glidos.net> wrote:
> Matthieu Moy wrote:
>> Paul Gardiner <osronline@glidos.net> writes:
>>
>>> Hi,
>>>
>>> I've moved a project from CVS on sourceforge to git on repo.or.cz. I
>>> want a local mirror on my own home server, so that it appears amongst
>>> the projects shown by my own gitweb set up, and so it gets caught by
>>> my backup system. I've created the mirror with
>>>
>>> git clone --bare <remote-url> <local-dir>
>>>
>>> and that seems fine. But how do I now keep it up to date. I was
>>> guessing a cron job doing some sort of git pull, but pull doesn't
>>> look to work on --bare proj.git type repositories.
>> You probably want "git fetch". Actually, "git pull" does a fetch first
>> (get the remote revisions that you don't have), and then a merge with
>> your working tree.
>
> Yeah, that's what I thought, but it doesn't seem to work with --bare
> repositories that are of the form proj.git, rather than having a dir
> proj containing checkout files and a .git folder. Both pull and fetch
> say that it isn't a git repository (although I can view it under gitweb,
> and I can clone and pule from it).
>
>
git-remote update is your friend then
Boaz
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: New to git: sorry for obvious question.
2008-02-04 9:56 New to git: sorry for obvious question Paul Gardiner
2008-02-04 10:27 ` Matthieu Moy
@ 2008-02-04 10:50 ` Luciano Rocha
2008-02-04 12:04 ` Paul Gardiner
2008-02-04 13:10 ` Boaz Harrosh
1 sibling, 2 replies; 8+ messages in thread
From: Luciano Rocha @ 2008-02-04 10:50 UTC (permalink / raw)
To: Paul Gardiner; +Cc: git
[-- Attachment #1.1: Type: text/plain, Size: 1069 bytes --]
On Mon, Feb 04, 2008 at 09:56:00AM +0000, Paul Gardiner wrote:
> Hi,
>
> I've moved a project from CVS on sourceforge to git on repo.or.cz. I
> want a local mirror on my own home server, so that it appears amongst
> the projects shown by my own gitweb set up, and so it gets caught by
> my backup system. I've created the mirror with
>
> git clone --bare <remote-url> <local-dir>
>
> and that seems fine. But how do I now keep it up to date. I was
> guessing a cron job doing some sort of git pull, but pull doesn't
> look to work on --bare proj.git type repositories.
You want git fetch. Git pull also updates the working copy, which you
don't have.
Also, git clone --bare doesn't set up the origin configuration, and I
have to do it by hand:
git config remote.origin.url "$url"
git config remote.origin.fetch "+refs/heads/*:refs/heads/*"
As for keeping clones up to date, I include a script I use daily for
that purpose.
--
Luciano Rocha <luciano@eurotux.com>
Eurotux Informática, S.A. <http://www.eurotux.com/>
[-- Attachment #1.2: update --]
[-- Type: text/plain, Size: 1480 bytes --]
#!/bin/bash
cd /media/stuff/src || exit 1
lockf=/tmp/.uprepo.lock
lockfile -60 -l 36000 -r 20 $lockf || exit 1
TL=$((20*60))
running()
{
kill -0 $* &> /dev/null
}
tl()
{
local max=$(($1+SECONDS))
shift
exec "$@" &
while running $! &> /dev/null && [ $max -ge $SECONDS ]; do sleep 1; done
if running $!; then
kill $! &> /dev/null
sleep 1
kill -9 $! &> /dev/null
fi
}
trap "rm -f $lockf" EXIT
shopt -s dotglob
for i in *.git */*.git; do
[ -h "$i" ] && continue
[ -d "$i" ] || continue
d="${i%/.git}"
echo $d
if [ "$d" = "$i" ]; then
(cd "$d" && tl $TL git fetch) 2>&1 | nocr
elif [ -d "$i/svn" ]; then
(cd "$d" && tl $TL git svn fetch) 2>&1 | nocr
elif [ -e "$d/.cvsurl" ]; then
(cd "$d" && tl $TL git cvsimport $(<.cvsurl)) 2>&1 | nocr
elif [ -e "$d/.svnurl" ]; then
(cd "$d" && tl $TL git svnimport -r $(<.svnurl)) 2>&1 | nocr
else
(cd "$d" && tl $TL git pull) 2>&1 | nocr
fi
done
for i in */*.hg */*/*.hg; do
[ -h "$i" ] && continue
[ -d "$i" ] || continue
d="${i%/.hg}"
echo $d
(cd "$d" && tl $TL hg pull)
done
for i in */*_darcs; do
[ -h "$i" ] && continue
[ -d "$i" ] || continue
d="${i%/_darcs}"
echo $d
(cd "$d" && tl $TL darcs pull -aq)
done
for i in */.svn; do
[ -h "$i" ] && continue
[ -d "$i" ] || continue
d="${i%/.svn}"
echo $d
(cd "$d" && tl $TL svn up -q)
done
for i in */CVS; do
[ -h "$i" ] && continue
[ -d "$i" ] || continue
d="${i%/CVS}"
echo $d
(cd "$d" && tl $TL cvs -Q -z3 up -P)
done
[-- Attachment #1.3: nocr --]
[-- Type: text/plain, Size: 130 bytes --]
#!/usr/bin/perl
use warnings;
use strict;
-t && exec "/bin/cat";
undef $/;
my $in = <>;
$in =~ s/^.*\r(?!\n)//gm;
print $in;
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: New to git: sorry for obvious question.
2008-02-04 10:50 ` Luciano Rocha
@ 2008-02-04 12:04 ` Paul Gardiner
2008-02-04 13:10 ` Boaz Harrosh
1 sibling, 0 replies; 8+ messages in thread
From: Paul Gardiner @ 2008-02-04 12:04 UTC (permalink / raw)
To: git
Luciano Rocha wrote:
> On Mon, Feb 04, 2008 at 09:56:00AM +0000, Paul Gardiner wrote:
>> Hi,
>>
>> I've moved a project from CVS on sourceforge to git on repo.or.cz. I
>> want a local mirror on my own home server, so that it appears amongst
>> the projects shown by my own gitweb set up, and so it gets caught by
>> my backup system. I've created the mirror with
>>
>> git clone --bare <remote-url> <local-dir>
>>
>> and that seems fine. But how do I now keep it up to date. I was
>> guessing a cron job doing some sort of git pull, but pull doesn't
>> look to work on --bare proj.git type repositories.
>
> You want git fetch. Git pull also updates the working copy, which you
> don't have.
>
> Also, git clone --bare doesn't set up the origin configuration, and I
> have to do it by hand:
> git config remote.origin.url "$url"
> git config remote.origin.fetch "+refs/heads/*:refs/heads/*"
Brilliant!! That works.
So why wouldn't git-fetch work when, instead of setting up the origin
config, I put the url and refspec on the commandline? - not that it
matters, just interested.
Cheers,
Paul.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: New to git: sorry for obvious question.
2008-02-04 10:50 ` Luciano Rocha
2008-02-04 12:04 ` Paul Gardiner
@ 2008-02-04 13:10 ` Boaz Harrosh
2008-02-04 14:17 ` Paul Gardiner
1 sibling, 1 reply; 8+ messages in thread
From: Boaz Harrosh @ 2008-02-04 13:10 UTC (permalink / raw)
To: Luciano Rocha; +Cc: Paul Gardiner, git
On Mon, Feb 04 2008 at 12:50 +0200, Luciano Rocha <luciano@eurotux.com> wrote:
> On Mon, Feb 04, 2008 at 09:56:00AM +0000, Paul Gardiner wrote:
>> Hi,
>>
>> I've moved a project from CVS on sourceforge to git on repo.or.cz. I
>> want a local mirror on my own home server, so that it appears amongst
>> the projects shown by my own gitweb set up, and so it gets caught by
>> my backup system. I've created the mirror with
>>
>> git clone --bare <remote-url> <local-dir>
>>
>> and that seems fine. But how do I now keep it up to date. I was
>> guessing a cron job doing some sort of git pull, but pull doesn't
>> look to work on --bare proj.git type repositories.
>
> You want git fetch. Git pull also updates the working copy, which you
> don't have.
>
> Also, git clone --bare doesn't set up the origin configuration, and I
> have to do it by hand:
> git config remote.origin.url "$url"
> git config remote.origin.fetch "+refs/heads/*:refs/heads/*"
>
Better do "git-remote add URL" then manual addition as above.
Boaz
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: New to git: sorry for obvious question.
2008-02-04 13:10 ` Boaz Harrosh
@ 2008-02-04 14:17 ` Paul Gardiner
0 siblings, 0 replies; 8+ messages in thread
From: Paul Gardiner @ 2008-02-04 14:17 UTC (permalink / raw)
To: git
Boaz Harrosh wrote:
> On Mon, Feb 04 2008 at 12:50 +0200, Luciano Rocha <luciano@eurotux.com> wrote:
>> Also, git clone --bare doesn't set up the origin configuration, and I
>> have to do it by hand:
>> git config remote.origin.url "$url"
>> git config remote.origin.fetch "+refs/heads/*:refs/heads/*"
>>
> Better do "git-remote add URL" then manual addition as above.
Would that be git-remote add --mirror origin URL?
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-02-04 14:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-04 9:56 New to git: sorry for obvious question Paul Gardiner
2008-02-04 10:27 ` Matthieu Moy
2008-02-04 10:41 ` Paul Gardiner
2008-02-04 10:51 ` Boaz Harrosh
2008-02-04 10:50 ` Luciano Rocha
2008-02-04 12:04 ` Paul Gardiner
2008-02-04 13:10 ` Boaz Harrosh
2008-02-04 14:17 ` Paul Gardiner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).