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
1. Create an environment variable to store your git username
```bash
GIT_USERNAME=mray190
```
2. Create an SSH key
```bash
ssh-keygen -t ed25519
```
3. Edit your `~/.ssh/config`. Replace GIT_USERNAME with your username
```bash
Host git.valor6800.com
    HostName git.valor6800.com
    Port 6822
    User GIT_USERNAME
    IdentityFile ~/.ssh/id_ed25519
```
4. Copy your SSH public key into your clipboard
```bash
cat ~/.ssh/id_ed25519.pub | clip
```
5. Paste your SSH public key into GitLab's SSH key settings: https://git.valor6800.com/-/profile/keys

## Putting it all together

1. Create a script called `./setup_git.sh`
2. Give your computer access to run the script: `chmod +x ./setup_git.sh`
3. Paste the contents into the script, and run with: `./setup_git.sh GIT_USERNAME`

Script contents:
```bash
#!/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
```