Last active
April 28, 2021 23:37
-
-
Save gotev/f4d93e69a30e5a66ef97c8d5d0b350db to your computer and use it in GitHub Desktop.
Revisions
-
gotev revised this gist
Apr 28, 2021 . 1 changed file with 2 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ if [ ! -f "$HOME/.ssh/id_ed25519" ]; then echo "git config --global user.email \"[email protected]\"" echo echo "When prompted where to save the certificate, press ENTER" echo "and then press ENTER two more times when asked to put in a password" echo ssh-keygen -t ed25519 -C "$EMAIL" || true else @@ -50,12 +50,10 @@ else echo "Host *" >> "$HOME/.ssh/config" echo " AddKeysToAgent yes" >> "$HOME/.ssh/config" echo " IdentityFile ~/.ssh/id_ed25519" >> "$HOME/.ssh/config" echo echo "Adding private key to SSH Agent" ssh-add "$HOME/.ssh/id_ed25519" fi echo "Copying SSH public key in the clipboard" -
gotev revised this gist
Apr 28, 2021 . No changes.There are no files selected for viewing
-
gotev revised this gist
Apr 28, 2021 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,7 +26,7 @@ if [ ! -f "$HOME/.ssh/id_ed25519" ]; then echo "When prompted where to save the certificate, press ENTER" echo "and then type in a password of your choice" echo ssh-keygen -t ed25519 -C "$EMAIL" || true else echo "Good! You have it!" fi @@ -55,6 +55,7 @@ else echo echo "Adding private key to SSH Agent" ssh-add -K "$HOME/.ssh/id_ed25519" ssh-add fi echo "Copying SSH public key in the clipboard" @@ -67,4 +68,4 @@ echo echo "1. Assign a custom title. For example: macOS SSH Key" echo "2. and then press COMMAND + V in the Key field" echo "3. Hit Add SSH Key" echo "4. Confirm with your password and then enable SSO if needed with your organization" -
gotev created this gist
Apr 28, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,70 @@ #!/bin/bash -e echo "macOS Helper to configure SSH Key to use with GitHub" echo "based off of instructions reported at:" echo "https://docs.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account" echo if [[ "$OSTYPE" != "darwin"* ]]; then echo "This script is designed for macOS only..." echo "exiting" exit 1 fi echo "Checking existing ed25519 SSH key..." if [ ! -f "$HOME/.ssh/id_ed25519" ]; then echo "You don't have it, generating it for you..." echo EMAIL=$(git config --global user.email) echo "Detected email from git config: $EMAIL" echo echo "IF IT'S NOT CORRECT, PLEASE HIT CONTROL + C TO EXIT THIS SCRIPT" echo "AND PROPERLY CONFIGURE YOUR GIT EMAIL WITH THIS COMMAND:" echo "git config --global user.email \"[email protected]\"" echo echo "When prompted where to save the certificate, press ENTER" echo "and then type in a password of your choice" echo ssh-keygen -t ed25519 -C "$EMAIL" else echo "Good! You have it!" fi echo echo "Starting SSH Agent in the background" eval "$(ssh-agent -s)" if [ ! -f "$HOME/.ssh/config" ]; then echo echo "Creating new SSH config" touch "$HOME/.ssh/config" else echo "Using existing SSH config" fi if grep -q "IdentityFile ~/.ssh/id_ed25519" "$HOME/.ssh/config"; then echo "SSH Config already correct!" else echo "Adding the configuration to SSH Config" echo "Host *" >> "$HOME/.ssh/config" echo " AddKeysToAgent yes" >> "$HOME/.ssh/config" echo " UseKeychain yes" >> "$HOME/.ssh/config" echo " IdentityFile ~/.ssh/id_ed25519" >> "$HOME/.ssh/config" echo echo "Adding private key to SSH Agent" ssh-add -K "$HOME/.ssh/id_ed25519" fi echo "Copying SSH public key in the clipboard" pbcopy < "$HOME/.ssh/id_ed25519.pub" echo echo "Now navigate to https://github.com/settings/keys" echo "and press on New SSH Key" echo echo "1. Assign a custom title. For example: macOS SSH Key" echo "2. and then press COMMAND + V in the Key field" echo "3. Hit Add SSH Key" echo "4. Confirm with your password and then enable SSO if needed with your organization"