DEV Community

Cover image for How to clone/download a GitHub Repository
Corey
Corey

Posted on • Updated on

How to clone/download a GitHub Repository

Sol addy: 4mgnTysrA7kQVYCsE2CJcaJzpX8xPxGPoKPz2LyiN782

So, as a beginner myself, i've been finding it pretty difficult to find shit. And by shit I mean tutorials on how to do basic stuff, stuff just to get started, so I thought I'd make a little something.

Here i'm going to show you how to clone a GitHub repository to a folder on your computer and get all the dependencies. Get all the what?!!

Dependencies: A software dependency is an external standalone library that can be as small as a single file or as big as multiple files and folders organized into packages to perform a specific task

Lets get Started

First, lets download some shit we need to get out of the way.

NPM: https://nodejs.org/en/download/

Yarn: https://classic.yarnpkg.com/lang/en/docs/install/#mac-stable

Git: https://git-scm.com/downloads

Cool, once all that is download, we can really get started.

Next, lets create a folder on our desktop(I use desktop so its easier for me to find, not sharpest tool in the shed) and name it whatever you'd like. I am naming it Test Repo.

Image description

Go ahead and copy that Folder and open up your terminal to point your directory to that folder by tying CD and pasting the folder path and hitting enter. It'll look like this: (of course it'll be your own path on your comp, so it won't have my name and shit).

Image description

Okay cool, now that we have our Terminal in the right directory we need to download the repo. Let's go download it. You can use any repo you'd like to get, but i'll give this link for now to test it all out.

https://github.com/coreyman11/oyster-swap.git

When you go to the link, you'll see something like the next screenshot. In the right corner, you'll see a button that says Code in green(1). Once you click the down drop menu, you'll then see a URL with a button next to it(2). Go ahead and click that button.(this copies the Git Repo URL to clone via HTTPS)

Image description

Now, let's go back to our Terminal window and type some stuff in. Once in Terminal type in the command:

Git Clone <Repository URL>
Enter fullscreen mode Exit fullscreen mode

In this case I'm using the test URL so it will be

Git Clone https://github.com/coreyman11/oyster-swap.git
Enter fullscreen mode Exit fullscreen mode

Hit enter and it will download the Repo into the folder we made on the Desktop!

Image description

Okay cool, now we need to download the Dependencies!!!

Let's go into the folder we made on our desktop. You'll notice there is a new folder there named Oyster-swap(well if you downloaded a different repo it'll be something different). Go ahead and copy that with command C on Mac and go back into your terminal window.

Image description

Once we are in the terminal window, we need to get in that oyster swap folder, so we will do the CD command again.

Cd /Users/coreystevens/Desktop/Test\ Repo/oyster-swap
Enter fullscreen mode Exit fullscreen mode

Image description

The next command we are going to type into the terminal will download the dependencies.

Yarn install
Enter fullscreen mode Exit fullscreen mode

This may take some time, but you should see a window like this once done: (If you have an error due to permission issues use this: Sudo yarn install.)

Image description

And that's it!! If you go into the file, you'll see we downloaded all the node_modules need(which were the dependencies).

Good shit, you just downloaded a Github Repo to your comp.

Next tutorial ill show you how to fork the repo to make your own copy of it and push the data onto the repo!!

Top comments (0)