Git is not GitHub. A while ago, after the n-th GitHub outage in a short period of time, I suggested adding an additional self-hosted git remote so that we can continue working and deploying code without having to rely on a single point of failure. That idea was quickly shunned by stating that we won’t host our code on Bitbucket or Gitlab in addition to GitHub. Of course, that was not at all what I meant, but it’s all too common these days that developers think: git == a graphical user interface on the web, which it obviously isn’t.
Unfortunately, most of today's "best practice" workflows rely on such UIs like GitHub to do things like code reviews, deploys, etc., basically removing all the positive aspects of a distributed version control system independent of network access or a central server. So here’s a rather lengthy and elaborate guide on how to self-host your code on a server and add it as a backup “remote” to your workflow, in case, you know, GitHub has another multi-hour outage during business hours after adding their latest emoji-sticker feature:
On a server: git init --bare your-project-name.git
Locally: git remote set-url origin git@servername.com:your-project-name.git
to add the remote
That's it, you're done.
I don't really use GitHub anymore, because GitHub sucks now, but just in case, here's how to set up GPG to sign your commits.
brew install gnupg
gpg --version
gpg --full-generate-key
gpg --ist-secret-keys --keyid-format=long
gpg --armor --export THE_ID_HERE
# --> copy this to your Github GPG keys
git config --global user.signingkey THE_ID_HERE
brew install pinentry-mac
which pinentry-mac
echo "pinentry-program /opt/homebrew/bin/pinentry-mac" >> ~/.gnupg/gpg-agent.conf
To sign commits, use: git commit -S -m "Commit message"
To restart:
killall gpg-agent && gpg-agent --daemon --use-standard-socket --pinentry-program /opt/homebrew/bin/pinentry-mac