# New to git

6 messages from 2011-04-08 to 2011-04-09. Participants: Marco Maggesi, Jeff King, Jonathan Nieder, Dmitry Potapov, Matthieu Moy.
Thread: https://gitlist.dev/t/27040

## Marco Maggesi, 2011-04-08 19:43

Subject: New to git
Message-ID: <BANLkTimy-95OJGxU9XzcaR=0jTJWXOwsDg@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTimy-95OJGxU9XzcaR%3D0jTJWXOwsDg%40mail.gmail.com

```
Hi,
I'm considering to use git to track my sources.
So far I was able to use git on a single machine and play with its
basic features.

Now I would like to setup a repository on a server and use it as a
central point of distribution for a few other computers.
As far as I can understand, the default mechanism for push / pull
requires that git is installed on every machine, including the server.

My problem is that I can hardly install git on the server for several
reasons that I will not explain here (also I'm not the administrator
of the server).
So I am looking for other solutions.

For the moment I came only to the following idea: mount the remote
repository via fuse-ssh and use the local installation of git to push
/ pull changes.
Surely it is inefficient but I don't care too much (my repositories
are small enough I think).
Can you see other drawbacks of this solution?

Also I wonder if other kind of synchronizations are possible (rsync,
unison, ...).

Are there other obvious solutions that I'm missing?

Thanks,
Marco

```

## Jeff King, 2011-04-08 20:10

Subject: Re: New to git
Message-ID: <20110408201024.GA15964@sigill.intra.peff.net>
URL: https://gitlist.dev/e/20110408201024.GA15964%40sigill.intra.peff.net
In-Reply-To: <BANLkTimy-95OJGxU9XzcaR=0jTJWXOwsDg@mail.gmail.com>

```
On Fri, Apr 08, 2011 at 09:43:09PM +0200, Marco Maggesi wrote:

> Now I would like to setup a repository on a server and use it as a
> central point of distribution for a few other computers.
> As far as I can understand, the default mechanism for push / pull
> requires that git is installed on every machine, including the server.

Yes, it's the default, but there are other mechanisms that don't require
server support. For example, rsync, and dumb http and ftp support.
They're not as efficient, but they do work.

For pushing, they are not as convenient. The dumb http push support goes
over DAV, so you must have a DAV server set up. Similarly, the rsync
support does not (as far as I know) do rsync-over-ssh, but expects to
connect to the rsync daemon directly.

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.

> My problem is that I can hardly install git on the server for several
> reasons that I will not explain here (also I'm not the administrator
> of the server).

You didn't list your reasons, so I'll assume they're good. But note that
you don't need to be the administrator to accept a git push. You can
build it as a regular user, and have git connect over ssh and run the
server side.

> For the moment I came only to the following idea: mount the remote
> repository via fuse-ssh and use the local installation of git to push
> / pull changes.
> Surely it is inefficient but I don't care too much (my repositories
> are small enough I think).
> Can you see other drawbacks of this solution?

That is inefficient, but I think it would work OK. If you are doing
that, though, you are probably better off just rsyncing the whole result
as I showed above. It's less inefficient and easier to set up (if you
have rsync on the server, of course).

-Peff

```

## Jonathan Nieder, 2011-04-08 22:54

Subject: Pushing to a "dumb" server (Re: New to git)
Message-ID: <20110408225127.GA27695@elie>
URL: https://gitlist.dev/e/20110408225127.GA27695%40elie
In-Reply-To: <BANLkTimy-95OJGxU9XzcaR=0jTJWXOwsDg@mail.gmail.com>

```
Hi,

Marco Maggesi wrote:

> My problem is that I can hardly install git on the server for several
> reasons that I will not explain here (also I'm not the administrator
> of the server).
> So I am looking for other solutions.

Have you looked into "git bundle"?

I should also mention that git can be run from ~/bin without trouble.
If you lack the ability to modify your $PATH, "git fetch" and "git
push" have --upload-pack and --receive-pack options that can be used
to specify alternate commands like '~/bin/git upload-pack'.

Ciao,
Jonathan

```

## Marco Maggesi, 2011-04-09 19:15

Subject: Re: New to git
Message-ID: <BANLkTikCF7Kv2xVYmr3O_P2t1TAzEFxXiA@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTikCF7Kv2xVYmr3O_P2t1TAzEFxXiA%40mail.gmail.com
In-Reply-To: <20110408201024.GA15964@sigill.intra.peff.net>

```
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).

> You didn't list your reasons, so I'll assume they're good. But note that
> you don't need to be the administrator to accept a git push. You can
> build it as a regular user, and have git connect over ssh and run the
> server side.

Well, the server is a very old machine and I didn't find easy to
compile git on it because of many missing dependencies (but I didn't
try very hard either).  A better solution would be to upgrade the
server.  But your solution is perfect meanwhile.

Thank you,
Marco

```

## Dmitry Potapov, 2011-04-09 19:35

Subject: Re: New to git
Message-ID: <BANLkTi=tU8vYMoD9bM9z6fy19OX40FLK=A@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTi%3DtU8vYMoD9bM9z6fy19OX40FLK%3DA%40mail.gmail.com
In-Reply-To: <BANLkTikCF7Kv2xVYmr3O_P2t1TAzEFxXiA@mail.gmail.com>

```
On Sat, Apr 9, 2011 at 11:15 PM, Marco Maggesi <marco.maggesi@gmail.com> wrote:
>
> Well, the server is a very old machine and I didn't find easy to
> compile git on it because of many missing dependencies (but I didn't
> try very hard either).

Some time ago, I built git on an old machine running Linux (RedHat 8.0
but maybe some packages were upgraded). Here is the line that I used:

make NO_OPENSSL=1 NO_NSEC=1 NO_CURL=1 NO_TCLTK=1 NO_PYTHON=1

I needed git only to push and fetch to that repository, and it worked
well for me.

Dmitry

```

## Matthieu Moy, 2011-04-09 22:41

Subject: Re: New to git
Message-ID: <vpqy63joxoe.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqy63joxoe.fsf%40bauges.imag.fr
In-Reply-To: <BANLkTikCF7Kv2xVYmr3O_P2t1TAzEFxXiA@mail.gmail.com>

```
Marco Maggesi <marco.maggesi@gmail.com> writes:

> 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/

```
