Forget the terminal. Download our native app instead.

Download GitHub for Mac

Skip the guide. Download our native app instead.

Download GitHub for Windows

If you've found yourself on this page, we're assuming you're brand new to Git and GitHub. This guide will walk you through the basics and explain a little bit about how everything works along the way.

Download and Install Git

At the heart of GitHub is an open source version control system (VCS) called Git*. Created by the same team that created Linux, Git is responsible for everything GitHub related that happens locally on your computer.

*If you don't already know what Git is, take a crash course.

Download and install the latest version of Git.

Tip: Git won't add an icon to your dock, it's not that sort of application.

Download and install the latest version of Git.

Use the default options for each step.

Warning: Do not use PuTTY if you are given the option. GitHub only provides support for openssh.

Download and install the latest version of Git.

Tip: Git won't add an icon anywhere, it's not that sort of application.

Download and install the latest version of Git.

Tip: Git won't add an icon anywhere, it's not that sort of application.

Set Up Git

Now that you have Git installed, it's time to configure your settings. To do this you need to open the Terminal.

Now that you have Git installed, it's time to configure your settings. To do this you need to open Git Bash (not the Windows command line).

Now that you have Git installed, it's time to configure your settings. To do this you need to open an app called Terminal.

Now that you have Git installed, it's time to configure your settings. To do this you need to open the command line.

Need a quick lesson about TerminalTerminalGit Bashthe command line?

Code blocks like those on this page are part of a scripting language called Bash. To use Bash scripts, we need to use an application that comes with your Mac called Terminal, usually found at /Applications/Utilities. Open Terminal was installed with Git called Git Bash. Git Bash can be found in the start menu under "Git".Open Git Bash comes with Linux called Terminal. Open the terminal comes with your OS called the command line.

Input

echo 'This is input text'
# This tooltip tells you what's going on.

A line that begins with the dollar sign ($) indicates a line of Bash script you need to type. To enter it, type the text that follows the $, hitting the return key at the end of each line. You can hover your mouse over each line for an explanation of what the script is doing.

Output

# This is output text.

A line that does not begin with a $ is output text that is intended to give you information or tell you what to do next. We've colored output text green in these bootcamp tutorials.

User Specific Input

echo 'username'
# Outputs the text in the quotation marks.

Areas of yellow text represent your own personal info, repos, etc. If it is part of an input ($) line, you should replace it with your own info when you type it. If it is part of output text, it is just for your reference. It will automatically show your own info in TerminalTerminalGit Bashthe command line.

Good to know: There will be times when you type code, hit return, and all you are given is another prompt. Some actions that you execute in TerminalTerminalGit Bashthe command line don't have any output. Don't worry, if there is ever a problem with your code, TerminalTerminalGit Bashthe command line will let you know.
Good to know: For security reasons, TerminalTerminalGit Bashthe command line will not display what you type when entering passwords. Just type your password and hit the return key.

Username

First you need to tell git your name, so that it can properly label the commits you make.

git config --global user.name "Your Name Here"
# Sets the default name for git to use when you commit

Email

Git saves your email address into the commits you make. We use the email address to associate your commits with your GitHub account.

git config --global user.email "your_email@example.com"
# Sets the default email for git to use when you commit

Your email address for Git should be the same one associated with your GitHub account. If it is not, see this guide for help adding additional emails to your GitHub account. If you want to keep your email address hidden, this guide may be useful to you.

Overriding settings in individual repos

The steps listed above show you how to set your user info globally. This means that no matter which repository you work in on your computer, you'll be making commits as that user. If you find yourself needing to make commits with different user info for a specific repository (perhaps for work vs. personal projects), you will have to change the info in that repository itself.

cd my_other_repo
# Changes the working directory to the repository you need to switch info for
git config user.name "Different Name"
# Sets the user's name for this specific repository
git config user.email "differentemail@email.com"
# Sets the user's email for this specific repository

Now your commits will be "blamed" on (associated with) the new user name and email whenever working in the specified repository.

Password caching

The last option we need to set will tell git that you don't want to type your username and password every time you talk to a remote server.

Tip: You need git 1.7.10 or newer to use the credential helper

To use this option, you need to install the osxkeychain credential helper and tell git to use it.

There is a chance you already have the osxkeychain helper, depending on if you installed git using homebrew or if you have the latest git version.

You can verify this by trying to run it:

git credential-osxkeychain
# Test for the cred helper
# Usage: git credential-osxkeychain <get|store|erase>

If you do not have the helper, you can download it with curl:

git credential-osxkeychain
# Test for the cred helper
# git: 'credential-osxkeychain' is not a git command. See 'git --help'.

curl -s -O \
  https://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain
# Download the helper

chmod u+x git-credential-osxkeychain
# Fix the permissions on the file so it can be run

Now you need to install the helper into the same directory where Git itself is installed.

sudo mv git-credential-osxkeychain \
  "$(dirname $(which git))/git-credential-osxkeychain"
# Move the helper to the path where git is installed
# Password: [enter your password]

To tell git to use osxkeychain, simply set the global git config:

git config --global credential.helper osxkeychain
# Set git to use the osxkeychain credential helper

The next time you clone an HTTPS URL that requires a password you will be prompted for your username and password, and to grant access to the OSX keychain. After you've done this, the username and password are stored in your keychain and you won't be required to type them in to git again.

To use this option, you need install a credential helper.

GitHub for Windows includes this helper, and provides a git shell so you don't need to install and configure git manually.

To use this option, you need to turn on the credential helper so that git will save your password in memory for some time:

git config --global credential.helper cache
# Set git to use the credential memory cache

By default git will cache your password for 15 minutes. You can change this if you like.

git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)

To use this option, you need to turn on the credential helper so that git will save your password in memory for some time:

git config --global credential.helper cache
# Set git to use the credential memory cache

By default git will cache your password for 15 minutes. You can change this if you like.

git config --global credential.helper 'cache --timeout=3600'
# Set the cache to timeout after 1 hour (setting is in seconds)

Tip: The credential helper only works when you clone an HTTPS repository URL. If you use the SSH repository URL instead, SSH keys are used for authentication. This guide offers help generating and using an SSH key pair.

Celebrate

Congratulations, you now have Git and GitHub all set up! What do you want to do next?