git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: New to git

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Apr 9, 2011, 22:41 UTC
Message-ID
<vpqy63joxoe.fsf@bauges.imag.fr>
In-Reply-To
<BANLkTikCF7Kv2xVYmr3O_P2t1TAzEFxXiA@mail.gmail.com>
Marco Maggesi <marco.maggesi@gmail.com> writes:
Show 19 quoted lines
> Hi Chris and Peff,
>
> 2011/4/8 Jeff King <peff@peff.net>:
>> But if you are just using the server as a distribution point for a
>> single repository, it can be much simpler. For example, if you always
>> just want to push and overwrite what is on the server (i.e., like a
>> mirror), you can just use plain rsync outside of git. To avoid mirror
>> lag, you do want to update the objects before the refs. So this:
>>
>>  LOCAL=/path/to/repo.git
>>  REMOTE=server:path/to/repo.git
>>  rsync -a $LOCAL/objects/ $REMOTE/objects/
>>  rsync -a $LOCAL $REMOTE
>>
>> would work. And then expose repo.git on the server via http or ftp, and
>> clients can clone directly from it.
>
> this is the solution I was looking for (but I where not sure that it
> worked).

It works, but "git push" does something that rsync can't: it will refuse non-fast forward, i.e. refuse to override commits that you don't have locally.

So, I'll just insist on the "if you are just using the server as a distribution point" part. If you ever push from two different machines to the server with rsync, you'll take the risk of loosing data.

If the server runs an HTTP server, an alternative is to push over WebDAV, it doesn't require Git on the server. It's slow, but safer than rsync.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Dmitry PotapovNext: Jonathan Nieder
Message 5 of 6 in “New to git”
  1. Marco MaggesiApr 8, 2011
  2. Jeff KingApr 8, 2011
  3. Marco MaggesiApr 9, 2011
  4. Dmitry PotapovApr 9, 2011
  5. Matthieu MoyApr 9, 2011
  6. Pushing to a "dumb" server (Re: New to git)Jonathan Nieder, Apr 8, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.