Skip to content

Instantly share code, notes, and snippets.

@DennisSchwartz
Last active June 10, 2019 11:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DennisSchwartz/20cab040a29143790dc8bf5b4b484873 to your computer and use it in GitHub Desktop.
Save DennisSchwartz/20cab040a29143790dc8bf5b4b484873 to your computer and use it in GitHub Desktop.
How to clone git repos

How to clone git repos from Github

Step 1: Make sure git is installed on your machine

Try using git in your terminal:

$ git --version

(The $ symbol means this is typed into the terminal) If you see

git version 2.21.0

or similar go to step 3. (No $ symbol means this is output) If you see

git: command not found

or similar got to step 2.

Step 2: Install git on your machine

MacOS

  1. Install Homebrew:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  1. Install git using Homebrew
$ brew install git
  1. Test git
$ git --version

Linux (Ubuntu or other apt based systems)

  1. Install git
$ sudo apt-get install git
  1. Test git
$ git --version

Step 3: Use git to clone repo

  1. Navigate to the directory where the code should live. By default, git will create a new subdirectory when cloning.
$ cd /path/to/your/code/dir
  1. Clone the repo
$ git clone git@github.com:username/reponame.git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment