#!/bin/bash
if ! [ -x "$(command -v xclip)" ]; then
echo 'Error: xclip is not installed.' >&2
sudo apt install curl
fi
if [ -e ~/.ssh/id_rsa.pub ]
then
xclip -sel clip < ~/.ssh/id_rsa.pub
else
read -p "Digite seu email do git: " email
ssh-keygen -t rsa -b 4096 -C email
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
fi
if [ -e ~/.ssh/id_rsa.pub ]
then
xclip -sel clip < ~/.ssh/id_rsa.pub
fi
git config --global url."git@github.com:".insteadOf "https://github.com/"
echo "Acesse sua conta do github. Entre em Settings, SSH and GPG keys, New SSH Key. Cole o conteudo e nomeie a chave, clique em salvar."