Skip to content

Instantly share code, notes, and snippets.

@dzungvu
Created December 2, 2023 15:42
Show Gist options
  • Save dzungvu/6cedf15f722f523d2d62078b23ab2cfe to your computer and use it in GitHub Desktop.
Save dzungvu/6cedf15f722f523d2d62078b23ab2cfe to your computer and use it in GitHub Desktop.
create ssh key with custom location and name
#create ssh key with specified location and name
ssh-keygen -t ed25519 -f ~/.ssh/key_name -C "[email protected]"
eval "$(ssh-agent -s)"
open ~/.ssh/config
#in case config file does not exist
touch ~/.ssh/config
# >>> content for config file: <<<
Host github.com
AddKeysToAgent yes
UseKeychain yes //remove if you do not pass the passphase for the key
IdentityFile ~/.ssh/id_ed25519
# >>> save the config file and back to the terminal window <<<
#add your SSH private key to the ssh-agent and store your passphrase in the keychain
#if you do not pass the passphase for the key, remove --apple-use-keychain option
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment