SSH Set Up
This guide will show you how to:
- Use 1Password to store your private ssh credentials.
- Have a biometrics security check whenever you commit or push.
- Have your personal and anon git account live side by side safely.
- Have signed commits.
đ Wonderland provides paid 1Password accounts for every member of the org.
Requirementsâ
- Install 1Password as an application on your computer.
Stepsâ
1. Create a new SSH keyâ
If you want a fresh start, create a new SSH key with the following steps:
Go to 1Password â New Item â SSH Key â Add Private Key â Generate a New Key
If you want to use your current SSH for this setup:
Go to 1Password â New Item â SSH Key â Add Private Key â Import a Key File
Do the above 2 times, to have both a personal and an anon ssh key (ONLY Mac/Linux).
2. Turn on the 1Password SSH agentâ
If you are on Windows (Ubuntu WSL) you will need to check if the OpenSSH Authentication Agent service is installed and disable it:
- Press Win+R and look for OpenSSH Authentication Agent in the list of services
- If you don't see it on the list, skip ahead.
- if you see it on the list then double click on OpenSSH Authentication Agent, in the "Startup type" menu, choose "Disabled".
To Turn on the SSH agent for any OS:
- Open 1Password app, click your account and choose Settings > Developer
- Select Set Up SSH Agent then choose whether you want to display SSH key names when you authorize connections.
Test your connection:
-
Windows (WSL)
ssh.exe -T git@github.com
-
Mac / Linux
ssh -T git@github.com
3. Configure your git profileâ
-
Windows (WSL)
- Create
~/.gitconfig
- Create
-
Mac / Linux
The following files will make sure you automatically use your anon ssh key whenever inside
~/Code/wonderland
, and your personal one whenever inside~/Code/personal
.Make sure to adapt it to fit your needs.
File:
~/.gitconfig
File:
~/.gitconfig-personal
File:
~/.gitconfig-wonderland
In order to try this out, using the terminal go to any git project inside
~/Code/wonderland
and paste the following:That command should print your anon git information.
4. Configure your SSHâ
-
Windows (WSL)
No action required.
(Optional) If you have multiple SSH keys within 1Password vaults you can edit its priority order by editing the
agent.toml
file located atC:\Users\Mati\AppData\Local\1Password\config\ssh\agent.toml
# Wonderland Anon Github Token
[[ssh-keys]]
item = "Github Anon"
vault = "Private"
account = "Wonder Ltd."
# Personal Github Token
[[ssh-keys]]
item = "Github Personal"
vault = "Personal"
account = "<THE_1PASSWORD_ACCOUNT_WHERE_YOU_HAVE_YOUR_PERSONAL_SSH>"Warning: This doesn't allow you to use multiple keys for different host as mentioned in https://www.notion.so/defi-wonderland/Git-and-SSH-Setup-with-1Password-22cf4135c7074898b95a4e88ac3e05c4?pvs=4#14c0bf386ef74c09b889b7cc85823af9
In this case, it is only useful for specifying the default ssh keys that 1Password will use.
-
Mac / Linux
File:
~/.config/1Password/ssh/agent.toml
File:
~/.ssh/pub/personal_git.pub
File:
~/.ssh/config
5. Configure your Github accountâ
- Go to https://github.com/settings/keys.
- Make sure "Flag unsigned commits as unverified" is checked.
- Click on New SSH Key
- Title: 1Password Wonderland
- Key type: Authentication Key
- Key: Paste your anon ssh public key
- Click on New SSH Key
- Title: 1Password Wonderland
- Key type: Signing Key
- Key: Paste your anon ssh public key
Authentication keys are used whenever you push/pull. Signing keys are used whenever you commit. In this case, you want to have both being the same ssh key.
That's it!â
Go ahead and try it out now.