Git and Github on Ubuntu

Steps to set­up Git on Ubun­tu and how to set up your first Github repos­i­to­ry (and why!)

The first day of work at Pineber­ry I set up my work­sta­tion (Ubun­tu 11.10, upgrad­ed to Ubun­tu 12.04 in June). A lot of the things were basic — PHP, MySQL, Apache… — but a few things were com­plete­ly new to me, includ­ing Git.

So, what is Git?

Git is a Ver­sion Con­trol Sys­tem, a dis­trib­uted one to be exact. The best descrip­tion I’ve seen to explain it comes from Git­Mag­ic, which com­pares cod­ing to play­ing games, and ver­sion con­trol to sav­ing progress in dif­fer­ent spots that you can return to lat­er.

The dis­trib­uted part means that there is no cen­tral or canon repos­i­to­ry, but rather that each repos­i­to­ry can be cloned inde­pen­dent­ly, tak­ing a peer-to-peer approach to it.

Installation

When I first installed it, I used the sim­plest ver­sion: sudo add-get install git which installed git, not too sur­pris­ing­ly. How­ev­er, at a lat­er point I need­ed to do some­thing — I can’t recall what any­more — and I found out that the ver­sion in Ubun­tu is not the newest. For good rea­sons, obvi­ous­ly, you want to ensure that the sta­ble ver­sion of any oper­at­ing sys­tem is sta­ble.

The ver­sion I use now, 1.7.10.4, was installed using the instruc­tions for Ubun­tu 10.04 by Adam Mon­sen.

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git

Connection between Git and Github

There is some con­fu­sion in what Git is and what Github is. Github is a social cod­ing web­site, main­ly for col­lab­o­rat­ing on (or stor­ing) Git repos­i­to­ries.

For a nice overview of a GitHub work­flow see their blog­post.


For the moment comments are not enabled, but feel free to reach out on Twitter.