This page will guide you through how to setup SSH keys to interact with the Valor git repositories without asking for a password every time.
Background
SSH vs HTTPS
SSH keys and why they are important
SSH key encryption types
What is an SSH config?
Setup
- Create an environment variable to store your git username
GIT_USERNAME=mray190
- Create an SSH key
ssh-keygen -t ed25519
- Edit your
~/.ssh/config
. Replace GIT_USERNAME with your username
Host git.valor6800.com
HostName git.valor6800.com
Port 6822
User GIT_USERNAME
IdentityFile ~/.ssh/id_ed25519
- Copy your SSH public key into your clipboard
cat ~/.ssh/id_ed25519.pub | clip
- Paste your SSH public key into GitLab's SSH key settings: https://git.valor6800.com/-/profile/keys
Putting it all together
- Create a script called
./setup_git.sh
- Give your computer access to run the script:
chmod +x ./setup_git.sh
- Paste the contents into the script, and run with:
./setup_git.sh GIT_USERNAME
Script contents:
#!/bin/bash
GIT_USERNAME=$1
ssh-keygen -q -t ed25519 -N '' <<< $'\ny' >/dev/null 2>&1
cat > ~/.ssh/config <<EOL
Host git.valor6800.com
HostName git.valor6800.com
Port 6822
User ${GIT_USERNAME}
IdentityFile ~/.ssh/id_ed25519
EOL
cat ~/.ssh/id_ed25519.pub | clip