| .config/git | ||
| .ssh | ||
| README.md | ||
Twinkspace Git Setup
A collection of sample configurations showing how different Git origins (in this case Twinkspace) can be used in parallel and painlessly for committing and signing via SSH.
This is not a functional template, but rather (excerpts from) individual configuration files that can be used as inspiration to integrate into your own dotfiles.
Also, this README is largely based on MacOS, as it is objectively and inevitably the best operating system – it should be similar on other UNIX-based systems.
Step by step
- Generate an SSH access key and choose a passphrase:
ssh-keygen -t ed25519 -C "user@twinkspace"
-
Add key to your SSH config as shown in .ssh/config
Note: I don’t managessh-agentmyself, since I’m using Apple’s keychain integration. I use this Launch Agent to automatically load all of my SSH passphrases from my keychain on login.
If you do it this way too, I recommend runningssh-add -Din order to be prompted for the passphrase once, which will be stored to your keychain afterwards. -
I prefer to sign commits with an SSH key instead of a GPG key, as GPG integrates very poorly with MacOS. So, generate another SSH key just for signing:
ssh-keygen -t ed25519 -C "user@twinkspace_sign"
-
Configure Git to sign commits with your SSH signing key as shown in .config/git/twinkspace. The email address needs to be added to your Forgejo account.
Note: Since I want to use different Git origins in parallel, I bound this config to~/Developer/@twinkspace/. You can adjust this in .config/git/config. Every Git repository in this folder will now use this configuration. -
Upload both public keys to your Forgejo account and verify at least your signing key!
-
(optional) Commit anything to a repository in your Twinkspace workspace:
git commit -m "i got rax now rhonda"
# no additional arguments are required in order to sign this commit!
You will be prompted for the SSH signing key passphrase for the first time.
Push this commit to Twinkspace:
git push
You will be prompted for the SSH access key passphrase for the first time.
A signed & verified commit should now appear on your repository’s homepage!
From now on, you are able to push signed commits to Twinkspace without any additional arguments or passphrase prompts 😳.
Don’t forget to load your existing identies from your keychain again, if you removed them from your agent before:
ssh-add --apple-load-keychain