Skip to content

Instantly share code, notes, and snippets.

@neverkas
Last active July 4, 2022 20:37
Show Gist options
  • Select an option

  • Save neverkas/da057465008d6e37669e5095181c3897 to your computer and use it in GitHub Desktop.

Select an option

Save neverkas/da057465008d6e37669e5095181c3897 to your computer and use it in GitHub Desktop.
SSH Keygen
NAME_PUBLIC_KEY=id_rsa.pub
PATH_PUBLIC_KEY=~/.ssh/$(NAME_PUBLIC_KEY)
URL_UPLOAD_PUBLIC_KEY=https://transfer.sh
##@ Deploy
ssh-key-create: ## generar clave publica
$(info Creando clave SSH..)
@./popup-ssh-keygen.sh
ssh-key-print: ## imprimir clave publica
@echo "Agregar la siguiente clave publica en (https://github.com/settings/ssh/new)"
@cat $(PATH_PUBLIC_KEY)
ssh-key-upload: ## subir clave publica a un servidor (https://transfer.sh)
curl --upload-file $(PATH_PUBLIC_KEY) $(URL_UPLOAD_PUBLIC_KEY)/$(NAME_PUBLIC_KEY).txt
#!/bin/bash
FILE=~/.ssh/id_rsa
if [[ -f "$FILE" ]]; then
echo "Error! La clave ssh ya esta generada en el equipo.."
exit 1
else
read -p "Ingrese su correo asociado a github: " email
# si usamos otro nombre de clave en vez de "id_rsa", tendremos problemas de permisos
# con el agente de ssh y tendremos que agregarlo
ssh-keygen -t ed25519 -C "$email" -f ~/.ssh/id_rsa -q -N ""
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment