Skip to content

Commit

Permalink
feat: add ssh key script
Browse files Browse the repository at this point in the history
  • Loading branch information
YasminTeles committed Mar 6, 2024
1 parent a8e6f88 commit b79f14b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help del
.PHONY: help del ssh

help: ## Show help.
@printf "A set of development's commands.\n"
Expand All @@ -9,4 +9,10 @@ help: ## Show help.

del: ## delete your environment configuration
@stow --dotfiles -D git
@stow -t ~/.ssh -D ssh
@rm -rf ~/Projects
@rm -rf ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub

ssh: ## Copy the SSH public key to your clipboard.
@pbcopy < ~/.ssh/id_ed25519.pub
@echo "Add the SSH public key to your account on GitHub or GiLlab. See your profile settings for more information."
20 changes: 14 additions & 6 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@

read -p "What is your email? " GIT_EMAIL

print "\nPlease wait! It will configure your environment. \n"
echo "[1/3] Creating the Projects folder..."
printf "\nPlease wait! It will configure your environment.\n"
echo "[1/4] Creating the Projects folder..."
mkdir ~/Projects

echo "[2/3] Setting up dotfiles..."
echo "[2/4] Setting up dotfiles..."
git clone https://github.com/YasminTeles/dotfiles.git ~/.dotfiles

cd ~/.dotfiles
stow --dotfiles git
stow -t ~/.ssh ssh

echo "[3/3] Configuring Git..."
echo "[3/4] Configuring Git..."
git config --global user.email $GIT_EMAIL

printf "\nSuccess Everythings is ready!"
printf "\nHave a nice day!"
echo "[4/4] Generating a new SSH key..."
rm -rf ~/.ssh/id_ed25519 ~/.ssh/id_ed25519.pub
ssh-keygen -t ed25519 -C $GIT_EMAIL -f ~/.ssh/id_ed25519 -q -N ""
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_ed25519
echo "Warning: You must add the SSH public key to your account on GitHub or GitLab. For more information, see make ssh"

printf "\nSuccess: Everything is ready!"
printf "\nHave a nice day!\n"
3 changes: 3 additions & 0 deletions ssh/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Host github.com
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519

0 comments on commit b79f14b

Please sign in to comment.