> You can’t push changes to a non-bare repo – if you try, Git will reject your push.
Sure you can. If the repo has branch foo checked out, but you're changing branch bar, it will happily let you push to bar (or bar->baz). And even if both are working with the same branch, whether or not you get a warning or it's accepted or rejected is controlled by 'receive.denyCurrentBranch'.
> Because nobody can “work” inside a bare repo, it’s always safe to receive pushes from other locations
Mmm... it's "safe" depending on what you're pushing and what's on the other end, which is no different from trying to push to a non-bare repo.
It's common to sync via ssh
git clone ssh://mydyn.dns/path/to/repo
If you have unique ssh settings you can put them in .ssh/configbut fyi, depending on your needs, git clone/push/pull doesn't sync everything. For example it doesn't sync .git/hooks
I use bare git repos and then a statically generated git web viewer using https://pgit.pico.sh
When I quit my last job, I was the only employee left that understood our tech stack. The other was a mechanical engineer and industrial designer. Because I felt that CEO could barely comprehend what git is or why it's important to pay AWS on time, I made a full backup of everything on a USB hard drive.
If you ever need to do this, it can be as simple as "git mirror", with extra steps for LFS and other addons.
That guy definitely did not deserve me to give him $100 of my own personal hard drive stash but out of some sick sense of professionalism I felt I had to give him a failsafe archive. Because, you guessed it, not one byte of the entire company was backed up anywhere.
> You can’t push changes to a non-bare repo – if you try, Git will reject your push.
You can push to a folder with a non-bare Git repo, it’s just that you can’t push the same branch which it has checked out.
Or in other words, if you get an error when trying to push to a folder with a checked out repo, push to a different remote branch.
(I do this regularly between WSL and the Windows host)
Cool! I wrote a similar blog post last year when I decided to "Cut GitHub out of the loop"
https://www.circusscientist.com/2025/07/23/cutting-github-ou...
My motivation was mainly the fact that Bitbucket cut their free tier, and who knows how long GitHub will be free? So I tried and found out how easy git actually is to sync without third parties
I know you're not really supposed to do it, but I've kept my git bare repos in syncthing for years
as long as you don't work on two machines at once and they're always online it's ... fine
(I do have a daily backup though)
I had a collection of bare repos like this on a private server for a while, but eventually decided to move them to a self-hosted forgejo instance. It provides a nice web interface, and can be configured to create a new repo simply by pushing to a new non-existing repo name, super handy.
Im quite happy with my setup.
I have the stock git server on a vm, gitweb to view things in the browser and gitolite for basic permission management.
Very low tech, almost no maintenance necessary and I dont more for hosting personal projects
Wait until you hear about subtree
It's interesting to me every time one of these "I just figured out I can use git without GitHub" posts comes up.
The entire design of git was intended to be decentralized. You really don't even need the centralized bare repo! You can just point your machines at each other. With Tailscale these days that's especially easy.
Admittedly, I'm getting old, but for the first couple years I used git professionally ~2008-2011 we just pulled from each other's machines. Directly over SSH. We worked in an office, all had each other's machines as remotes. "Hey, is that feature done? Cool, I'll pull it". It worked really well.
Eventually we tossed a bare repo up on a server in the office and switched to push instead of pull. Finish a feature? Push it up! At some point our devops guy installed Gitlab around that, but we never really used the web ui.
Winds changed, we moved to GitHub, eventually a pull request / code review workflow. Here we are now.