Setting Up and Using SSH Keys

Generate App State Key
ssh-keygen -t ed25519 -C "[email protected]" -f ~/.ssh/id_ed25519_appstate
Add Key to SSH Agent
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519_appstate


 Add a Public Key to GitHub

Mac
pbcopy < ~/.ssh/id_ed25519_appstate.pub
Linux
cat ~/.ssh/id_ed25519_appstate.pub
Windows (Git Bash)
cat ~/.ssh/id_ed25519_appstate.pub | clip
  1. Log in to GitHub with your username_appstate account.
  2. Open your settings menu, click on SSH and GPG keys, then click New Key.
    Click add new SSH Key.

  3. Paste the key and then click Add.
    Paste in the SSH key and then click Add SSH key.


Edit ~/.ssh/config:

 Personal GitHub

Host github.com
    HostName github.com

    IdentityFile ~/.ssh/id_ed25519_personal


App State GitHub

Host github-appstate
    HostName github.com

App State GitHub (Host github-appstate)
IdentityFile ~/.ssh/id_ed25519_appstate


Clone Repositories

Personal Repo
git clone [email protected]:username/repo.git
App State Repos
git clone git@github-appstate:username_appstate/repo.git

Update Existing Repos

If you already cloned App State repos, update the remote:

git remote set-url origin git@github-appstate:username_appstate/repo.git

Test Connections

Personal Account
ssh -T [email protected]
App State Account
ssh -T git@github-appstate

Alternative: Use HTTPS

Clone with HTTPS and use Personal Access Tokens instead of SSH:

git clone https://github.com/username_appstate/repo.git

To generate a token, open your GitHub settings and click on Developer settings, then Personal Access Tokens


For more information, see  Connecting to GitHub with SSH.