HACKER Q&A
📣 multiplied

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


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)


  👤 simon_acca Accepted Answer ✓
Git is peer to peer, you can add an ssh remote that points to the directory containing the git repo on another machine.

https://stackoverflow.com/questions/4131164/how-do-i-pull-fr...


👤 vineyardlabs
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.


👤 hnthrow10282910
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

👤 mindwork
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

👤 fhaldridge7
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

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

👤 stop50
I have my own forgejo instance

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

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

about git, yes a server is the answer