Skip to content
This repository has been archived by the owner on Dec 19, 2017. It is now read-only.

Tips for working with Git and Github

Ian Wehrman edited this page Jun 15, 2015 · 1 revision

git/bower behind firewalls

To make bower work in places where git:// URLs don't work (e.g. inside a corporate firewall), run this git command:

git config --global url."https://".insteadOf git://

To undo that after you've quit your job at a large corporate institution, run:

git config --global --unset url."https://".insteadOf

Github authentication without SSH

A side effect of using git over HTTPS instead of SSH (as with git:// URLS) is that, by default, you will be asked to enter your Github password before every command that requires authentication. Luckily, git can be configured to cache your credentials in memory, as described here.

Bash autocompletion and inline status

Add the following to your ~/.bash_profile:

source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-completion.bash
source /Applications/Xcode.app/Contents/Developer/usr/share/git-core/git-prompt.sh

DEFAULT="\[\033[0;39m\]" 
CYAN="\[\033[1;36m\]" 
GREEN="\[\033[1;32m\]" 
BLUE="\[\033[1;34m\]" 
YELLOW="\[\033[1;33m\]" 
MAGENTA="\[\033[1;35m\]" 
GRAY="\[\033[0;37m\]" 

PS1="$GREEN(\$(date +%H:%M:%S)) $GREEN\u$GREEN@$GREEN\h$DEFAULT:$CYAN\w$YELLOW\$(__git_ps1 \" (%s)\") $DEFAULT\$ ";
GIT_PS1_SHOWDIRTYSTATE=true
Clone this wiki locally