DEV Community

loading...

GitHub: Making and Cloning Repositories

mariel
Dev. I love dogs, cookies, and learning new things.
・3 min read

As discussed previously, a repo is where you keep your code. If you’re like me, you will be making and changing and deleting and remaking hundreds of them.

You’re also going to need to look up how to do things just as many times. Derp.

Making a New Repo in GitHub - Where's the button?

The first place you'll see the green "new" button is on your homepage when you're logged in. It'll be on the far left side, along with a list of your other repos and a search bar.

If you navigate to your profile page and click on "Repositories" next to "Overview" you'll see it again.

Okay now what?

When you click on "new" you'll be taken to the page to create a new repo. All you really need is:

  • A repo name (e.g. my-good-dog)
  • A description (e.g. A project about my dog)
  • Select whether it will be public or private

Then you can click the green "Create Repository"


For this post, I'm going to assume we've started a project on our machine and we're trying to get it into a repo, so go ahead and skip this.

But how do I make it talk to my project?

It's really easy to do from the command line (you’ll need to have already set up git for this).

If you've already been working on your project, you want to do the below:

Once this is done, you'll be able to push your edits/commits from the command line woo! (And always remember: save early save often.)

Attack of the Clones

Now that your repo is up and running, you're in good shape. If you remember a time before computers, you also remember how much it ABSOLUTELY SUCKED to only have local copies of things and watch them go TOAST.

Now we live in the future where you can have a local copy AND a remote copy AND make them talk to each other. Which is pretty much what cloning is in GitHub.

Say your dog came along and deleted your project from your machine because you were spending too much time working and not enough time playing fetch. Now what?

Well, since you set up your repo and you've been GOOD AND CONSISTENT about making commits, you can clone it back down to your machine and pick up where you left off.

On the page for your repo, you'll see a green "Clone or download" button on the far right.

Go ahead and copy the SSH link and in your terminal, navigate to where you want your project to live. For this example, I'm just going to put it on my desktop:

Use"git clone" and the SSH link you copied, and enter your password:

Then you'll see your computer do some thinking:

And then poof! In the location you specified, you should now see a folder with the same name as your repo. If you open it, you'll see all your code safe and sound and ready to be worked on.

So now, after you play fetch with Fido, you can go back to your machine and work on your project just as you did before - it's connected to the remote repo, so you can push and commit as normal.

Bartlet Saying What's Next

Next time, we'll talk about making commits. Get excited.

Discussion (0)