Skip to content

Instantly share code, notes, and snippets.

@allomov
Created June 14, 2012 20:49
Show Gist options
  • Save allomov/2932850 to your computer and use it in GitHub Desktop.
Save allomov/2932850 to your computer and use it in GitHub Desktop.
Install git from scratch
# Install git from (OS X version)
# use this complite script to detect OS:
# https://github.com/coto/server-easy-install/blob/master/lib/core.sh
# for OS X download and install package from here:
# http://code.google.com/p/git-osx-installer/downloads/
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 "/usr/local/git/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
# Generate ssh key
mkdir ~/.ssh; cd !$;
ssh-keygen -t rsa -C "your_email@youremail.com"
# Copies the contents of the id_rsa.pub file to your clipboard
pbcopy < ~/.ssh/id_rsa.pub
echo "RSA key is copied to clipboard, add it to your github account"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment