-
Notifications
You must be signed in to change notification settings - Fork 0
/
ssh-key.sh
executable file
·21 lines (15 loc) · 926 Bytes
/
ssh-key.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bash
mkdir ~/.ssh
#curl https://raw.githubusercontent.com/Peter-512/.dotfiles/main/id_ed25519.pub > ~/.ssh/id_ed25519.pub # Figure out a way to detect if run from curl or from local file
cp ./id_ed25519.pub ~/.ssh/id_ed25519.pub
ansible-vault decrypt ~/.ssh/id_ed25519.pub
#curl https://raw.githubusercontent.com/Peter-512/.dotfiles/main/id_ed25519 > ~/.ssh/id_ed25519 # Figure out a way to detect if run from curl or from local file
cp ./id_ed25519 ~/.ssh/id_ed25519
ansible-vault decrypt ~/.ssh/id_ed25519
chmod 700 ~/.ssh/id_ed25519
# Adding your SSH key to the ssh-agent
# https://docs.github.com/en/github/authenticating-to-github/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#adding-your-ssh-key-to-the-ssh-agent
eval "$(ssh-agent -s)"
touch ~/.ssh/config
printf "Host *\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/id_ed25519" > ~/.ssh/config
ssh-add -K ~/.ssh/id_ed25519