- Open your text editor of choice. TextEdit works just fine.
- You probably want to use your personal email rather than nclud email, as your Git user should be for you.
- Download the latest version of git
- code.google.com/p/git-osx-installer/downloads/list?can=3
- Download Git Installer 1.7.9.3 - OS X - Snow Leopard - Intel Universal
- Once downloaded, open up the .dmg file
- Open the package git-1.7.9.3-intel-universal-snow-leopard.pkg
- Go through the installer
Terminal is simple application that allows you to use your computer like a nerd from the 70's, making use of the command line. Nerds today still use the command line. As Git is for nerds, all of Git's functionality is only available through the command line when it first installed.
- Open Terminal
- Easiest way to open Spotlight ( Cmd + Space ) and find Terminal
- Or, in Finder, find it in /Applications/Utilities/
Once opened, you'll see something like this prompt:
Last login: Wed Mar 14 11:40:02 on ttys001
computer-name:~ username$
Gross.
- Check that Git has been installed
- type
which git
- type
git --version
.
which git
# >> /usr/bin/git
git --version
# >> git version 1.7.9.3
- Follow instructions on GitHub Help: Set Up SSH Keys, proceed with steps 1-3.
Getting the SSH key can be a pain
- After creating SSH keys, we need to open id_rsa.pub
- open ~/.ssh in Finder
- If you are already in Terminal, type
open .
- or from Finder, go to folder ( Go > Go to Folder or Cmd + Shift + G ) ~/.ssh
- If you are already in Terminal, type
- Open id_rsa.pub in your text editor
- Add this key as instructed on the GitHub help page
- Download the GitHub Mac app
- In the preferences or intro screen, add your account details
- Name
- Email address
- GitHub username or email address
- GitHub password
- Repo is short for repository. This is the name for our projects
- Let's make a folder for our repos
- In Finder, navigate to your home directory ~/ or Cmd + Shift + H
- Create a new folder repos
- Clone this repo via GitHub app. Click on Clone in Mac
- In the save file prompt, clone this repo into your ~/repos/ folder as git-training
- Let's create a new file
- Duplicate trainees/trainee-template.txt
- Change the name of trainee-template copy.txt to firstname-lastinitial.txt, i.e. dave-d.txt
- Awesome, now let's commit this change
- Open the GitHub app
- Select the nclud/git-training repo
- In the left-hand icon navigation, select Changes
- Under Uncommited Changes you'll see your new file already selected. This means the new file is already staged. (We'll get into staging later)
Commits require a message -- a basic statement to keep track of what changes you have made.
- In commit summary, enter a message about adding the file, i.e. : Added dave-d trainee
- Then click the Commit button
- You'll see your commit as Unsynced Commit
- View History (left-hand icon navigation) and you'll see your commit
We'll be syncing this commit later. Let's keep making changes.
- Open your trainee file in a text editor (TextEdit works).
- Add in your info.
For example:
Name: Dave D
Twitter: @desandro
Favorite 90's TV show: MTV Rock n Jock
Preferred breakfast food: English breakfast
Last time jumped rope: Prolly 2 years ago
Peanut butter [ smooth / chunky / ew gross ]: SUPERCHUNKY
- Save the file
- Back in GitHub app, go to Changes
- You'll see the lines you have added in green, and the lines you have removed in red
In our case, all the previous lines have been removed, and all the edited lines appear as added. This is just how Git handles changes.
- Like with the last commit, add a message Commit summary, i.e. Added trainee info for dave-d
- Click Commit
You should now have two unsynced commits.
- Click the Sync button
Two things just happened:
- Your changes were pushed up to the GitHub remove server
- Other's people changes were pulled into your local repo
You should now see commits from your colleagues.
Awesome!
You are now on your way to collaborating with Git.
The GitHub app is a great interface once for working with repos that are already on GitHub. But it doesn't do a good job with a lot of parts of Git. Like...
- Creating a new repo
- Checking out commits
- Creating new repo
- Checking out commits
- Push
- pull
- viewing changes
- submitting issues