# Fetch from remote A, push to remote B

5 messages from 2007-05-31 to 2007-06-01. Participants: Martin Langhoff.
Thread: https://gitlist.dev/t/8372

## Martin Langhoff, 2007-05-31 05:53

Subject: Fetch from remote A, push to remote B
Message-ID: <46a038f90705302253s68b70311h3feac7404fa23933@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90705302253s68b70311h3feac7404fa23933%40mail.gmail.com

```
Is there an easy way to get a "passthrough" repo setup so I can say on a cronjob

  git-fetch remoteA
  git-push ssh+git://host/path/to/repoB.git remotes/remoteA/<all>

The 2 repositories cannot talk to each other directly.

cheers,


martin

```

## Martin Langhoff, 2007-05-31 07:28

Subject: Re: Fetch from remote A, push to remote B
Message-ID: <46a038f90705310028y6f180214s9018f8af5e71d0ed@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90705310028y6f180214s9018f8af5e71d0ed%40mail.gmail.com
In-Reply-To: <46a038f90705302253s68b70311h3feac7404fa23933@mail.gmail.com>

```
On 5/31/07, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> Is there an easy way to get a "passthrough" repo setup so I can say on a cronjob
>
>   git-fetch remoteA
>   git-push ssh+git://host/path/to/repoB.git remotes/remoteA/<all>

After mucking about with stuff like...

find .git/refs/remotes/origin -type f -printf '%P\0' | xargs -0
-IHEADNAME git-push
git+ssh://git.catalyst.net.nz/var/git/moodle-r2-testing.git
origin/HEADNAME:HEADNAME

I figured out that a bare repo did the trick

  # set things up
  git-clone --bare git+ssh://host-a/bla.git bla-transfer.git

  # on cron do
  GIT_DIR=bla-transfer.git git-fetch git+ssh://host-a/bla.git
  GIT_DIR=bla-transfer.git git-push --all git+ssh://host-b/bla.git

cheers!


martin

```

## Martin Langhoff, 2007-06-01 00:37

Subject: Re: Fetch from remote A, push to remote B
Message-ID: <46a038f90705311737u7e9a118v9b9865f63a4c6951@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90705311737u7e9a118v9b9865f63a4c6951%40mail.gmail.com
In-Reply-To: <46a038f90705310028y6f180214s9018f8af5e71d0ed@mail.gmail.com>

```
On 5/31/07, Martin Langhoff <martin.langhoff@gmail.com> wrote:
>   # on cron do
>   GIT_DIR=bla-transfer.git git-fetch git+ssh://host-a/bla.git
>   GIT_DIR=bla-transfer.git git-push --all git+ssh://host-b/bla.git

Actually -- this doesn't quite work - the fetch grabs the new objects
properly but doesn't update the local heads on a bare repo.

cheers,



m

```

## Martin Langhoff, 2007-06-01 01:52

Subject: Re: Fetch from remote A, push to remote B
Message-ID: <46a038f90705311852n136a2bfbwa943a65a43257a6e@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90705311852n136a2bfbwa943a65a43257a6e%40mail.gmail.com
In-Reply-To: <46a038f90705311737u7e9a118v9b9865f63a4c6951@mail.gmail.com>

```
On 6/1/07, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> On 5/31/07, Martin Langhoff <martin.langhoff@gmail.com> wrote:
> >   # on cron do
> >   GIT_DIR=bla-transfer.git git-fetch git+ssh://host-a/bla.git
> >   GIT_DIR=bla-transfer.git git-push --all git+ssh://host-b/bla.git
>
> Actually -- this doesn't quite work - the fetch grabs the new objects
> properly but doesn't update the local heads on a bare repo.

Should this work?

GIT_DIR=bla-transfer.git git-fetch git+ssh://host-a/bla.git
+refs/heads/*:refs/heads/*

Earlier discussions about mirroring tools (and Pasky's git-mirror)
finished with this being the recommended technique. Only - it does on
me with

* refusing to create funny ref 'heads/*' locally

cheers,



martin

```

## Martin Langhoff, 2007-06-01 03:51

Subject: Re: Fetch from remote A, push to remote B
Message-ID: <46a038f90705312051l663bc522r9c5c51bc803c2bc8@mail.gmail.com>
URL: https://gitlist.dev/e/46a038f90705312051l663bc522r9c5c51bc803c2bc8%40mail.gmail.com
In-Reply-To: <46a038f90705311852n136a2bfbwa943a65a43257a6e@mail.gmail.com>

```
To finish off the soliloquy... effective mirroring with git

  git-clone --bare git://host/repo.git mirror.git
  git --git-dir=mirror.git config remote.origin.url git://host/repo.git
  git --git-dir=mirror.git config remote.origin.fetch
'+refs/heads/*:refs/heads/*'

  and now, on cron...
  git --git-dir=mirror.git fetch -u
  git --git-dir=mirror.git remote prune origin

(Thanks to Shawn Pearce for helping me figure out why it wasn't working for me!)

cheers



martin

```
