bugwo.menv4

bugwo.men v4

holy fucking bingle

Deploying My Website Via Git

By Ada
Posted on 2026-10-24

In my first steps towards becoming the Blazingly-Fast 10x FullStack DevOps AI-Agent Jira GitHub-Actions React-Native SharePoint 🚀 Sigma® Dev I was always destined to be, I have now harnessed the power of the "post-receive hook" to merge the public git repo for my personal website and the dead simple sftp-put based deployment setup I've been using into one beautiful homunculus of a "deployment pipeline". Is this what this IC/DC thing is supposed to be, or do you need GitHub for that?

Vibe coders are all idiots, real blazingly fast 10x fullstack devops AI agent jira github actions react native sharepoint rocket emoji sigma devs know dildo coding is the way of the future
— me

For real though, I like this new system a lot. It both forces me to actually use the Git repo like a normal person and collapses the incredibly tedious process of typing put path/to/changed/file path/on/server into sftp for every fucking change into a single git add . && git commit && git push one-liner that VSCodium even has a built-in button for, plus I don't need to worry about the possibility of LLM scrapers randomly and without warning bringing my now-defunct Forgejo instance to its knees at an arbitrary point in the medium-near future.

The basic rundown of how my new setup works is as follows: I have a bare git repo for my website on my server that I push to over SSH, at which point a post-receive hook in that repo clones it into the folder from which my reverse proxy serves it. That's pretty much it. This means that a single git push updates both the public-facing repository and the live website, and the contents of both always match exactly. Simple and elegant as hell.

The basic rundown of how my old setup worked is as follows: I pushed changes to the live copy of my site over sftp. There was, incidentally, also a Git repo for it inside a Forgejo instance on the server that had zilch to do with the actual live version of the site and only existed to back up and make public my local development copy. Both needed to be updated separately and there was no guarantee that either of them matched each other or the local copy. I'm sure you can see how the new setup constitutes an improvement.

The Forgejo instance is gone now, also replaced by this setup, with a Cgit instance for public viewing and cloning of the repo, but the Pipeline™ is entirely independent of that, so I won't really get into it here. If you want to set that up, here's a decent guide, or you could pretty trivially swap it out for Stagit or Sorcery or probably a half a dozen other things with zero impact on the part this post is actually about.

That's not to say I think Forgejo is worse — in fact, I like it a lot and would probably go with Codeberg if I was gonna actually accept contributions on a project — but it is more resource-hungry, infamous for self-hosted instances getting kneecapped by swarms of aggressive scrapers, and actually makes this one specific thing harder, all for a million fancy-pants collaboration-at-scale features that I was never gonna use on my single-user instance anyway.

Anyway, in THIS video I'm gonna show YOU how to rig your shit up EXACTLY like mine. Right after a word from our sp

Part 1: Basic ass git server

Git actually comes pre-packaged with all you need for a barebones git server that can be pushed to over SSH, and it's a lot simpler to set up than I was expecting it to be. I mean, it was enough of a pain in the ass that I felt the need to write a guide, but it was mostly surprisingly easy.

I pretty much just followed the official Git docs word-for-word, but I'll copy the instructions over here for your convenience.

First, add a user on your server for the git server and switch to it:

adduser git
su git
cd

If you have ssh pubkey authentication set up (which you should) now's the time to enable it for the git user as well. I just did this by copying the contents of my admin user's .ssh/authorized_keys file into the git user's one at /home/git/.ssh/authorized_keys.

mkdir .ssh && chmod 700 .ssh
touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys
exit
nano ~/.ssh/authorized_keys
<copy the contents>
su git
nano ~/.ssh/authorized_keys
<paste, save and exit>

This is actually what I did.

Test to make sure ssh login works, and if it does, the git server is now technically set up. You can create repositories anywhere on the server that the git user has read/write permissions by creating a directory for the repo (convention dictates that you call it repoName.git but you don't have to, it's just a folder) and initializing a bare repository in there:

mkdir repoName.git
cd repoName.git
git init --bare

Or, alternativatively,

git init --bare repoName.git

Now you should be able to add it as a remote with git remote add origin git@your.domain:/absolute/path/to/repoName.git on your machine, or if you're lazy like me and just put your repositories in a folder in the git user's home directory, with git remote add origin git@your.domain:relativePathTo/repoName.git.

Part 2: Deploying from that sucker

This is also pretty simple, but the reason for this post existing is that it was deceptively hard to actually get it to work, and I want to spare you from my suffering.

It's as shrimple as cloning your repository to another folder on the server:

cd /place/you/want/your/site/to/live
git clone /path/to/repoName.git

, pointing your reverse proxy to the resulting folder so it serves from there, and appending the following line to the file repoName.git/hooks/post-receive:

repoName.git/hooks/post-receive

...
git --work-tree /var/www/liveSiteDirectory/ --git-dir /var/www/liveSiteDirectory/.git/ -C /var/www/liveSiteDirectory/ pull
...

That file is just a shell script that Git runs every time it gets a push to that repo, and this command runs git pull in the folder you just cloned your website to. That's all. The reason making this work was a multi-hour pain in my dick, and the reason this guide exists, is because doing the same thing from the terminal looks like this:

git -C /var/www/liveSiteDirectory/ pull

It seems there's something Different about automated scripts that causes that command to silently fail unless you use all three of Git's "specify the working directory" arguments to make sure it takes.

So anyway, that's the whole guide. If you did everything right, any pushes you make to that repo will be immediately reflected on the live site. I admit this post might be a little more complaining than it is guide, but my policy for writing these is that I only write the guide if I did the thing and wished the guide I'm writing had been available at the time, and if I had found this article while bashing my head against this problem I would have donated to the author's Ko-fi. So.

Sort of relatedly, check out the dope ass theme I wrote for my Cgit instance! Pretty cool, huh? I sure hope so. I spent like two days bashing that 20-year-old HTML into shape with CSS alone to make it look like that.


Comments