Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🆕 Create git config file #79

Merged
merged 2 commits into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions settings/git/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# ssh-keygen -t rsa
# chmod 600 id_rsa
# eval `ssh-agent` && ssh-add ~/.ssh/id_rsa
# ssh-add -l
# pbcopy < ~/.ssh/id_rsa.pub
#
# ssh -T git@github.com
#

Host github.com
HostName github.com
User git
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
UseKeychain yes
AddKeysToAgent yes

27 changes: 27 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,33 @@ function command_exists {
command -v "$1" > /dev/null;
}

#
# Copy git ssh config file
#
echo " ------- Git SSH config ------"
cp $(cd $(dirname ${BASH_SOURCE:-$0}); pwd)/settings/git/config ~/.ssh/config
while true; do
read -p 'Now git ssh settings? [Y/n]' Answer
case $Answer in
'' | [Yy]* )
ssh-keygen -t rsa
chmod 600 ~/.ssh/id_rsa
eval `ssh-agent`
ssh-add ~/.ssh/id_rsa
ssh-add -l
echo "Let’s register your public key on GitHub"
break;
;;
[Nn]* )
echo "Skip settings"
break;
;;
* )
echo Please answer YES or NO.
esac
done;
echo " ------------ END ------------"

#
# Memorize user pass
#
Expand Down