Getting started with Git on Mac! a.k.a. Git For Non-Dev N00bs like me)
Let me preface this. I’m NOT a programmer.
That said, I like to think that I’m as close to being a programmer that a non-programmer can be. I’ve directed and/or worked with dev teams in 3 languages (PHP, Django/Python, Java), and can spec out and work with everything from database details to core functionality to top-level architecture to UI/UX with awesome HTML + CSS + Javascript. All that aside, I’ve only had limited hands-on experience with revision control systems, and then only with Subversion, and not Git.
Since my current (and awesomely awesome) dev team uses Git, and I’ve been doing a lot of template revisions, changes and drafts myself, I had to learn to how get Git on the fly today. Nothing like jumping all the way in eh?
If you don’t know what Git is, according to Wikipedia:
Git is a distributed revision control system with an emphasis on speed. Git was initially designed and developed by Linus Torvalds for Linux kernel development. Every Git working directory is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server.
A.K.A. it helps teams of software developers work together and coordinate on the same project without screwing up each others work. Since I’m making tons of template changes, my dev team needed an easy way to track my changes between my local copy through implementation on the live site (in this case www.girlgamer.com and www.ani.me). At its core, Git runs entirely via command line.
Oh, Command Line, I love you for your awesome power but hate you for your syntax.
The beauty of Git via command line is that is that it is super-powerful and execute many advanced functions that have no easy way to be done via a graphical user interface (GUI). The downside for me is that for my use case, mainly changing and committing front end template HTML, I would never need any of the advanced functions. Ideally for me, a good easy GUI would suffice, and be optimal. Even better, would be having built-in support from Coda (OS X/MAC), which I use for my edits, but that doesn’t exist yet. After reviewing TONS of options, and finding ideally great, but now defunct, GUI projects, I’ve come up with the following:
- Install Git and link it with your repository @ GitHub (see below for a quick and dirty how to)
- Grab GitX (Great for viewing commits, or alternatively BrotherBard’s fork) & GitY (For most other things) + Plugins for Coda http://justinhileman.info/git-for-coda
- Grab GitBox (An alternative to GitX + GitY) http://gitbox.pierlis.com/
Once setup via command line, I should never have to go back to command line. I can use GitX/GitY as a plugin from Coda for tracking updates, else I can use GitBox for pushing/committing my changes.
Getting set up, quick and dirty.. well not so dirty.
If you don’t know how to set up Git on OS X, here’s the process that @brosner led me through (it’s easier and shorter than it looks):
- Set up an account and repository on www.GitHub.com (Also I hear Beanstalk is pretty awesome too)
- Grab and install Git http://code.google.com/p/git-osx-installer/downloads/detail?name=git-1.7.1.1-intel-leopard.dmg
- Jump into OS X (Snow Leopard)’s Terminal
- Type and run: git
- - You should see basic info on the Git install.
- Navigate to your directory with the initial files for the repository via the command cd
- Once your in the directory, run: git init
- Then run: git add .
- - Note the “.”
- Now all files and subfolders in that folder should be indexed/added to Git for push to the remote (Github) repository.
- - Run this to see what has been “staged” for the next commit: git status
- - Staged files are files that haven’t been pushed to the remote repository yet
- If you don’t have TextMate installed and hooked up to Terminal, do that (unless you prefer command-line vi):
- - Once installed, open TextMate, go to Help, and choose Terminal Usage, then Create Link (use default setting)
- Run: mate ~/.gitconfig
- - Within the new file in TextMate, paste the text from here (using your own name and email of course): http://dpaste.de/MqbD/
- Save then close file.
- Go back to Terminal (assuming you’re still in your repository directory)
- Make your first commit and note (quotes ARE needed) by running: git commit -m “my message about this commit”
- Now to add Github as the remote repository, run the line provided in your Github admin, similar to: git remote add origin git@github.com:username/repositoryname.git
- Next we need to set up a secure RSA key so you can securely push to GitHub, this is a one-time thing only:
- - Create a RSA ID by running: ssh-keygen -t rsa
- - - When prompted for which file to save key in (unless otherwise desired), press Enter.
- - - When prompted for a passphrase (unless otherwise desired), press Enter and re-confirm.
- - - That created a key, now to copy it, run: cat ~/.ssh/id_rsa.pub | pbcopy
- - - Go to https://github.com/account and click SSH Public Keys then Add Public Key
- Choose any Title and in the Key area, you should be able to paste the previously copied key. Then save that.
- Back in Terminal, push your local files to GitHub by running: git push origin master
- Once that’s done, back at Github, view the repository, you should see your files.
- - Add any collaborators in Github, and you should be setup.
Now from here onward, I plan on using Coda to edit and GitBox or GitY to commit and push changes to GitHub. I’ll let you guys know how that goes. But you should be good to go. If you have a better way or a suggestion, or if Coda finally starts supporting Git, let me know!
Also, here are some resources for jumping in a bit more (also from @brosner):
- http://shaun.boyblack.co.za/blog/2009/03/14/getting-started-with-git-on-mac-os-x/
- http://gitcasts.com/
Now back to work for me..




1 year ago




