How to clone a repository on GitHub to your local machine


How to clone a repository on GitHub to your local machine

 

 TL;DR

  • You need to have git installed. See 'How to install git'
  • Go to the folder to which you need to clone the repository
  • Open up a Terminal/Command Prompt
  • Type git clone https://github.com/imadx/fractals
  • Here the imadx is the username, fractals is the repository name
  • wait for it..
  • E:\blogger\git>git clone https://github.com/imadx/fractals
    Cloning into 'fractals'...
    remote: Counting objects: 13, done.
    remote: Total 13 (delta 0), reused 0 (delta 0), pack-reused 13
    Unpacking objects: 100% (13/13), done.
  • Done

Keep reading..

What is the difference between cloning and downloading?

Cloning a repository is almost the same as downloading the content of the repository. But there is a bit more to that. When cloning a repository you are not just copying the content. You are copying the history of the repository as well. You can move around repository back and forth, commit changes and can create pull reqeusts for your commited changes to the original repository
In other words, cloning a repository gives you a copy of that repository and configures the original repository as a remote.

To where does the repository get cloned to?

When cloning a repository note that a new folder will be created on the current working directory with the name of the repository

How to find the URL of a repository?

You need to know the URL of a repository in order to clone a git repository. The URL of a repository is simply the link you use to view the repository on GitHub. Goto GitHub's site and search for the repository to find it's URL. But most of the times, a Google Search query will direct you to this link.
Say you need to find the linux repository. Just type linux on github on Google. It's easy as that.

Ishan

Ishan Madhusanka is a dynamic developer, with a great enthusiasm in Web and Mobile Development. Eventhough he is a developer, he has this awesome creativity at its apex which helps him to polish up the UI/UX aspect of his products

1 comment: