This lesson will guide you through the installation process for git but just what is necessary to obtain the cocos2d source code. Installing git is already well documented by the folks at github so i'll often refer to their instructions but i've condensed it to the absolutely necessary information so that you can race through that process a lot quicker.
You want a free account, so use this link to sign up with github for free. While you are waiting for the github confirmation email you can continue with the next two steps which don't require you to have a github account.
Click this link to download the latest git version.
You'll see a list of downloads like above but version numbers may differ. Just pick the topmost file, mount the .dmg and install the package (.pkg file).
Generating an SSH key may seem daunting at first. It's not that bad. Just follow the instructions and type into Terminal what is displayed on the screenshots of the GitHub instructions.
If you know that you don't have an SSH key yet i've recreated the command sequence here for your convenience. Open Terminal.app and simply replace your e-mail address with the one you signed up with on github:
cd ~/.ssh
ssh-keygen -t rsa -C "YOUR@EMAIL.ADDRESS"
cat ~/.ssh/id_rsa.pub | pbcopy
The last command puts the SSH key into your clipboard. If you overwrite your clipboard contents just re-enter the first and last command into Terminal.app.
Refer to the instructions on github in case you are having trouble with my descriptions.
Login to your github account and go to your account settings.
Click on the SSH Public Keys button.
Paste your SSH key into the text-box labelled "Key". Title is used to identify your key in case you have many, enter any text you like. Then click "Add key" and you are almost done.
There are a few settings git requires. Enter the commands below in Terminal.app and replace YOURLOGIN with your github login and e-mail address. Your API Token is shown on your Account Settings page on the right hand side when you are on the "Account Overview" Tab. Copy the token and paste it below instead of YOURTOKEN. If you ever change your github password, you have to update your token as well.
git config --global user.name "YOURLOGIN"
git config --global user.email "YOUR@EMAIL.ADDRESS"
git config --global github.user YOURLOGIN
git.config --global github.token YOURTOKEN
That's it. You're ready to use git!
If you're having trouble with this step, refer to the instructions on github to setup your name, email and github token.