Skip to content

Instantly share code, notes, and snippets.

@PhilGeek
Created July 25, 2008 08:15
Show Gist options
  • Save PhilGeek/2407 to your computer and use it in GitHub Desktop.
Save PhilGeek/2407 to your computer and use it in GitHub Desktop.
Git installation script
#!/bin/sh
#
# installgit.sh
#
# A bash script to install the latest version of Git. Be sure to set the variables to the desired values.
#
# http://git.or.cz/
#
# Mark Eli Kalderon 2008-07-25
# Git. Change to the desired versions if necessary
VER="1.5.6.4"
GIT="git-${VER}"
GITMAN="git-manpages-${VER}"
# Build directories. Change to the desired directories if necessary.
GBLDDIR=/var/tmp/${GIT}-build
# Create Git build directory, but save source files if they exist.
test -d ${GBLDDIR} || mkdir ${GBLDDIR}
test -d ${GBLDDIR}/${GIT} && /bin/rm -rf ${GBLDDIR}/${GIT}
cd $GBLDDIR
# Download and unpack Git source.
curl http://kernel.org/pub/software/scm/git/${GIT}.tar.gz -O
tar -xvzf ${GIT}.tar.gz
cd ${GIT}
# Configure and build Git.
./configure --prefix=/usr/local
make
# Install Git. Will prompt for password.
sudo make install
# Install documentation. Will prompt for password.
curl -O http://kernel.org/pub/software/scm/git/${GITMAN}.tar.bz2
sudo tar xjv -C /usr/local/share/man -f ${GITMAN}.tar.bz2
# Configure Git
# Use Apple opendiff (FileMerge) for resolving conflicts
git config --global merge.tool opendiff
# Ignore Carp
git config --global core.excludesfile ~/.gitignore
touch ~/.gitignore
echo '.DS_Store' >>~/.gitignore
echo '._*' >>~/.gitignore
echo '.svn' >>~/.gitignore
echo '.hg' >>~/.gitignore
echo '.aux' >>~/.gitignore
echo '.log' >>~/.gitignore
echo '.out' >>~/.gitignore
echo '.pdfsync' >>~/.gitignore
echo '.bbl' >>~/.gitignore
echo '.blg' >>~/.gitignore
echo '.brf' >>~/.gitignore
echo '.svn' >>~/.gitignore
echo '.dvi' >>~/.gitignore
echo '.toc' >>~/.gitignore
echo '.bak' >>~/.gitignore
echo '.nav' >>~/.gitignore
echo '.snm' >>~/.gitignore
echo '.fls' >>~/.gitignore
echo '.fdb_latexmk' >>~/.gitignore
# Shortcuts
git config --global alias.st status
git config --global alias.ci commit
git config --global alias.co checkout
git config --global alias.br branch
# Colors? YES
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment