top | item 41273716

Ask HN: How do you sync your Git repos across machines at home?

5 points| multiplied | 1 year ago

I have a multi machine setup and I don't want to use a third party service as a proxy to what I could be doing locally.

One obvious answer is to stand up my own local git server, perhaps finally put those Raspberry-pi's.

Any suggestions to improve upon this?

Even if I do go down the path of the raspberry pi, how do I configure it to hide behind the router where it is shielded from the external internet. (I want it completely disjointed from the internet if possible)

19 comments

order

vineyardlabs|1 year ago

You already have everything you need to do this with just git. Just make a repo (might need to be a bare repo) on whatever machine you want to make the remote and then clone from it using ssh on the other machines. Then you can push and pull just as if the remote was in github or whatever.

If you want more functionality than that, gitlab has a free tier that can be self-hosted. same with gittea.

stephenr|1 year ago

You don't need to use a bare repo necessarily if you want to push/pull between two working repos, without a central "bare" repo locally, you just need to tell git to update when receiving:

`git config receive.denyCurrentBranch updateInstead`

hnthrow10282910|1 year ago

You can setup glusterfs incredibly easily. When you write to one dir it’ll auto replicate to N machines. Did this over the weekend and it took me no time at all. Support is realistically Linux only IIRC with some MacFuse stuff for OSX

multiplied|1 year ago

How does it handle conflicts?

mindwork|1 year ago

I use tailscale to access my machines around the world. It's secure and private. Nobody on the internet knows about this machines, even though they are servers. Easy to configure

multiplied|1 year ago

Tailscale is one of those services that feel too good to be true. I have known about it but can't get myself to trust it.

fhaldridge7|1 year ago

I have my git repos in one folder ~/git and then use syncthing to sync across all machines. It works great, I can start doing changes on one machine and then pick up the work on another machine without interruption

multiplied|1 year ago

I was thinking about this, but how does syncthing handle conflicts?

KittenPassingBy|1 year ago

I run a self hosted gogs instance. Centralized storage is much easier to backup.

multiplied|1 year ago

Interesting, thanks for bringing it up.

stop50|1 year ago

I have my own forgejo instance

pavel_lishin|1 year ago

A bare repo on a server, which I `got push` to and `git pull` from.

multiplied|1 year ago

Locally hosted server? AWS ECS instance?

I also realize there's Amazon CodeCommit, interesting.

pestatije|1 year ago

what, no firewall?...some bots would be happy to know ur ip address

about git, yes a server is the answer

multiplied|1 year ago

Yeah of course a firewall, I just don't know enough about the exact setup there, and that's part of my question.

Diving into that rabbit hole now.