-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup-git
21 lines (18 loc) · 894 Bytes
/
setup-git
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env zsh
echo "\n🐙 \033[1mSetting up git and GitHub…\033[0m";
echo "(Please follow the instructions in the terminal)\n";
vared -p 'Enter your full name (e.g. John Doe): ' -c fullname &&
git config --global user.name $fullname &&
vared -p 'Enter the e-mail you use for GitHub ([email protected]): ' -c email &&
git config --global user.email $email;
git config --global pull.ff "only";
git config --global init.defaultBranch main
ssh-keygen -t ed25519 -C $email;
eval "$(ssh-agent -s)";
echo "Host *\n AddKeysToAgent yes\n UseKeychain yes\n IdentityFile ~/.ssh/id_ed25519" > ~/.ssh/config;
ssh-add -K ~/.ssh/id_ed25519;
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts # add github.com to the list of known hosts
echo "Authenticating with GitHub.com…";
gh auth login;
echo "\n✨ \033[1m…all done!\033[0m";
echo "You can now use git with your GitHub account.\n";