Installing Git
24 Jan
It’s pretty easy to get Git installed.
1.) Install Based on Your Operating System
Linux
You may already have git installed. If not, use your package manager:
$ yum install git-core
or
$ apt-get install git-core
Mac
For 10.5 or later, download and install the appropriate installer from http://code.google.com/p/git-osx-installer/
Windows
Download and install the latest installer from http://code.google.com/p/msysgit/
Note to Windows Users
There are several nice GUIs for Git on Windows. It is fine to use these, but I would highly recommend learning the basics of Git using the command line. Because:
- You’ll better understand what’s going on which will allow you to better troubleshoot if you encounter a problem down the road when working with your GUI
- You will more than likely find yourself in front of a Unix environment one day and you’ll already know how to deal w/ Git.
2.) Verify Git is Installed
Open up a command prompt, terminal, console or whatever you want to call it and type:
$ git
If you see something like :
$ git: command not found
Something’s not right. Try installing again and take a look at your PATH environment variable.
But if you see something like:
usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [--html-path]
[-p|--paginate|--no-pager] [--no-replace-objects]
[--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE]
[--help] COMMAND [ARGS]
The most commonly used git commands are:
add Add file contents to the index
...
You’re good to go!
3.) Configure Your User Name
After you have Git installed, a terminal and set your name and email address for Git to use to sign your commits:
$ git config --global user.name "John Doe" $ git config --global user.email "jdoe@domain.com"
More Information
The Git Community Book has a little more detail on installing Git for your operating system here: http://book.git-scm.com/2_installing_git.html
