· 9 years ago · Oct 01, 2016, 08:08 AM
1#!/bin/bash
2
3usage()
4{
5echo
6echo "NAME"
7echo " ${0##*/} - kickstart git"
8echo
9echo "SYNOPSIS"
10echo " ${0##*/} NAME EMAILDOMAIN"
11echo
12echo "EXAMPLES"
13echo " kickstart git setup for Jonh Doe"
14echo " ${0##*/} jonh.doe gmail.com"
15echo
16exit 1
17}
18
19name="$1"
20email="$2"
21[ -z "$name" -a "${name+x}" = "x" ] && usage
22[ -z "$email" -a "${email+x}" = "x" ] && usage
23
24if git --version &>/dev/null; then
25 echo "configuring basic git settings"
26 echo git config --global color.ui "auto"
27 git config --global color.ui "auto"
28
29 echo git config --global user.name $name
30 git config --global user.name $name
31
32 echo git config --global user.email "$name@$email"
33 git config --global user.email "$name@$email"
34
35 echo ssh-keygen -t rsa -b 4096 -C "$name@$email"
36 ssh-keygen -t rsa -b 4096 -C "$name@$email"
37
38 eval "$(ssh-agent -s)"
39
40else
41 echo "git is not installed. exiting..."
42 exit 1
43fi
44
45#vim:ts=4