Skip to content

Instantly share code, notes, and snippets.

@faloi
Last active October 10, 2015 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save faloi/3747476 to your computer and use it in GitHub Desktop.
Save faloi/3747476 to your computer and use it in GitHub Desktop.
First-time Git setup with ssh
NAME=$1
EMAIL=$2
done_message() {
echo "Done!"
echo ""
}
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Couldn't run script!"
echo "Usage is sh gitinit.sh [your_name] [your_email]"
exit 1
fi
echo "Setting up git global settings..."
git config --global user.name $NAME
git config --global user.email $EMAIL
git config --global color.ui true
done_message
echo "Creating ssh key, press ENTER when prompted for filename..."
ssh-keygen -t rsa -C $EMAIL
done_message
echo "Copying your brand new ssh key to your clipboard..."
clip < ~/.ssh/id_rsa.pub
done_message
echo "Now go to your remote git provider (e.g. GitHub, BitBucket) and paste it!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment