Live data from Hacker News

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

news.ycombinator.com

11–20 of 21 posts

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

#12

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.

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`

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

#14

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

Thank you, I was considering this but I need to be able to not rely on both machines being online.

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

#16

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

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

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

#17

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

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.

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

#18

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

How does it handle conflicts?
Post reply on HN