Clone the Repository Using the Command Line

After you’ve created a repository on the remote, the next step is to clone it to your local environment.

gif of following the directions below

  1. Navigate to your repository’s Code tab.
  2. Click Clone or download.
  3. Copy the URL provided.
  4. Open your command line or Terminal application and enter the directory where you would like to copy the repository. This can be anywhere in your local file system, like your home directory. For example:

     cd ~/
    
  5. Clone the repository by replacing <URL> with clone URL you copied in the previous step. The repository will be cloned into a new directory in this location.

     git clone <URL>
    
  6. Navigate into the directory of the repository you just created. Replace with your own repository's name.

     cd <REPOSITORY-NAME>
    
  7. Type:

     git status
    

    git status is a command you will use often to verify the current state of your repository and the files it contains. Right now, we can see that we are on branch master, everything is up to date with origin/master and our working directory is clean.

Tell me why

Remote vs. Local Repositories

Let’s take a moment to define a couple of important terms:

A remote repository is the copy of your project that is housed on GitHub.com. You access this copy through a unique URL.

A local repository is a copy of the remote repository that you have cloned to your computer. This copy includes all of the files, history, and branches in your project.

In this class, you will make changes to this local repository and then sync them with the copy of your project on GitHub.com.

Stuck? Open an issue in the repository for this class and mention @githubteacher for help from one of the GitHub trainers!
Continue