pawelgrimm / bootstrap

My bootstrap script for setting up a new mac.
0 stars 0 forks source link

Add ssh keygen #2

Open pawelgrimm opened 2 years ago

pawelgrimm commented 2 years ago

Would be nice if it copied to clipboard and opened settings page to add to GH account

pawelgrimm commented 2 years ago

# Generate key, email should get prompted
ssh-keygen -t ed25519 -C "your_email@example.com"

# Verify SSH agent is active
eval "$(ssh-agent -s)"

# Make sure there's an ssh config file
touch ~/.ssh/config

# automatically load keys into the ssh-agent and store passphrases in your keychain.
echo "Host *
  AddKeysToAgent yes
  UseKeychain yes
  IdentityFile ~/.ssh/id_ed25519" >> ~/.ssh/config

# Register the key
ssh-add --apple-use-keychain ~/.ssh/id_ed25519

# Copy to clipboard
pbcopy < ~/.ssh/id_ed25519.pub