Installing git on Mac OS X

I’m starting a new project where the source code is hosted on github so I had to install git on my Mac OS X. Git is an open source, distributed version control system. To install it on my Mac, I downloaded the installer package from google code (also available via MacPorts). After installing the package, I had to configure it to work with github.

Open the Terminal application (Applications->Utilities->Terminal).


   git config --global "your name here"
   git config --global your-email-address-here

   git config --global github.user your-github-user-here
   git config --global github.token your-github-api-token-here
   git config --global core.autocrlf true

If you receive the error:
git: Command not found

You will have to add the git directory to your PATH variables:
echo 'export PATH=/usr/local/git/bin:$PATH' >> ~/.profile

Restart Terminal and then enter:
echo $PATH

You should see that the git directory was appended to the PATH.

If you are using github, ‘github.user’ and ‘github.token’ can be obtained by clicking on your account link and then clicking on “Global Git Config”.

In order to use github, you will also need to create an ssh key:

ssh-keygen -C "your name or email address" -t rsa

To copy your public key to the clipboard:

cat | pbcopy

You can then paste it into the appropriate place on githubs site.

Note: id_rsa is the default name of your public key file. If you gave it a different name, then obviously you would ‘cat’ that name. Enjoy.

Be Sociable, Share!

Checkout My New Site - T-shirts For Geeks