Setup Git

Local settings

git config --global user.name "Stefan van der Walt"
git config --global user.email stefan@sun.ac.za

Sharing a repository over http

To enable syncing over http, you need to run

git --bare update-server-info

in the repo - git needs the additional information to address the stateless nature of http (they're working on a proper http protocol). You can run the update via a post-commit hook in .git/hooks.

Command Prompt

In ~/.bashrc:

function parse_git_branch
{
    ref=$(git symbolic-ref HEAD 2> /dev/null) || return
    echo -e "\ngit[${ref#refs/heads/}] "
}

GREEN="\[\033[01:32m\]"
BLUE="\[\033[01;34m\]"
BLACK="\[\033[00m\]"

PS1="$BLUE\u@\h:\w$BLACK"'$(parse_git_branch)\$'

Setting up aliases


(16:22:40) DavidC: Here is what I have in my $HOME/.gitconfig for aliases
(16:22:42) DavidC: [alias]
    ci = commit
    di = diff --color-words
    st = status
    co = checkout

Github authentication problems

$ git push origin master
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
error: failed to push to 'git@github.com:...'

Fix:

$ cd ~/.ssh
$ ssh-add id_rsa

IanKnot rainbow -->