How to clone your forked GitHub repository using via a command line interface – 040

It is time to get into coding examples from the command line!

In previous tips, you used either the Create new file or Edit file buttons on GitHub.com itself to make changes to a repo. Then you selected the Create a new branch for this commit option in either the Commit new file or Commit changes form to create a new branch (which will be used by a Pull Request).

In the upcoming days, you’ll see how to setup a branch in your local repo so you can submit a bug fix to the base repo as a Pull Request.

From your favorite Command line Interface (I’m using GitHub Desktop’s Git Shell that opens Git Bash – see yesterday’s tip), you’ll want to

  1. Clone the repo
  2. Create a branch (see tomorrow’s tip)
  3. Make your changes (see tomorrow’s tip)
  4. Push your branch back up to your GitHub repo (see the day after tomorrow’s tip)

But first, let’s clone the repo.

Go to the desired repo. For this example, I’m using saraford-tips/your-moment-of-github-zen

You can get the clone instructions from clicking the Clone or download dropdown button, and then coping the URL (either select the text inside the edit box or click the Copy to clipboard button).

Clone with HTTPS window showing URL

Now from the command line, run git clone <copied url>

image

Now cd into your repo, and you are all set locally! I always do a git status just out of habit.

showing git status from local cloned repo

Leave a comment