Articles

Simple Install of Git on Leopard

Here’s how to install Git on Mac OS X Leopard

mkdir -p ~/Downloads/src
cd ~/Downloads/src

# Set options since we don't have GNU gettext installed
export TCL_PATH=`which tclsh`
export NO_MSGFMT=1
export GIT_VERSION='1.6.5.3'

# Get and install git
curl -O "https://kernel.org/pub/software/scm/git/git-$GIT_VERSION.tar.bz2"
tar xjvf "git-$GIT_VERSION.tar.bz2"
cd "git-$GIT_VERSION/"

# When on Mac OS X
./configure
make
sudo make install

cd ..

# Install Man Pages
curl -O "https://kernel.org/pub/software/scm/git/git-manpages-$GIT_VERSION.tar.bz2"
sudo tar xjv -C /usr/local/share/man        -f "git-manpages-$GIT_VERSION.tar.bz2"

Only needs some minor modifications to work on Dreamhost

mkdir -p "$HOME/src"
cd "$HOME/src"

# Set options even though we have GNU gettext installed
export TCL_PATH=`which tclsh`
export NO_MSGFMT=1
export GIT_VERSION='1.6.5.3'

# Get and Install Git
curl -O "https://kernel.org/pub/software/scm/git/git-$GIT_VERSION.tar.bz2"
tar xjvf "git-$GIT_VERSION.tar.bz2"
cd "git-$GIT_VERSION/"

# When on Dreamhost:
./configure --prefix="$HOME" NO_CURL=1 NO_MMAP=1
make
make install

cd ..

# Don't Bother Installing the Man Pages

After installing, you'll want to configure it

# Use Apple opendiff (FileMerge) for resolving conflicts (Mac OS X only)
git config --global merge.tool opendiff

# Ignore Carp
git config --global core.excludesfile ~/.gitignore
touch               "$HOME/.gitignore"
echo '.DS_Store' >> "$HOME/.gitignore"
echo '._*'       >> "$HOME/.gitignore"
echo '.svn'      >> "$HOME/.gitignore"
echo '.hg'       >> "$HOME/.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.ui auto

# Personal Setup
git config --global user.name "Your Name"
git config --global user.email your_email@your-domain.com

# Setup Bash Completion
mkdir -p "$HOME/bin"
export PATH="$HOME/bin:$PATH"
echo 'export PATH="$HOME/bin:$PATH"'               >> ~/.bash_profile
cp "$HOME/Downloads/src/git-$GIT_VERSION/contrib/completion/git-completion.bash" ~/bin
echo 'source ~/bin/git-completion.bash'            >> ~/.bash_profile

# Add the current Git Branch to your Bash Prompt
echo "PS1='[\u@\h \w\$(__git_ps1 \" (%s)\")]\\$ '" >> ~/.bash_profile

Thomas Aylott Polaroid

Thomas Aylott / subtleGradient