PDF download Download Article PDF download Download Article

Git is a very common tool in collaborative software development. Cloning a repository locally stores the latest changes of a project, allowing you to branch off and make your own edits without immediately affecting someone else’s work. To do this, you will need to download Git or other Git-supported software, locate the repository you wish to clone, and specify a location to save the cloned repository. This can be done from the command line program, or with a program’s supported graphical user interface (GUI). [1]

Method 1
Method 1 of 3:

Using the Command Line

PDF download Download Article
  1. Go to https://git-scm.com/downloads and select the download for the platform you are using.
  2. Navigate to a location of your choosing in your computer. Then right-click (or Ctrl + click) and select “New Folder”.
    • For simplicity, it may be best to create your first repository folder on the Desktop.
    Advertisement
  3. This program is installed along with the git tools, however you can also use the natively installed Command Prompt (Windows) or Terminal (Mac/Linux).
  4. Enter the “cd” command following by the path to the repository folder you created. Folders in the path are separated by “\”. Hit Enter to complete the action.
    • For example, a folder on the desktop for Windows would use the command “cd c:\users\[username]\desktop\[foldername]”
    • “cd” stands for “change directory”
    • You can change directories one at a time instead of all at once if you find it faster to type: “cd desktop” Enter “cd folder name” Enter .
  5. Go to the github (or whichever git alternative) page of the repository you are trying to clone. The source location of the repository will be displayed on the repository page.
    • The exact location of the source location will vary depending on which repository site you are using, but they are usually located near the top for easy access. Look for a URL.
    EXPERT TIP

    Kevin Burnett

    Software Developer
    Kevin Burnett is a Software Developer with over 20 years of professional experience. He works for SpiffWorkflow, a Python Process Automation tool for organizations. Prior to SpiffWorkflow, he spent the majority of his career at Rosetta Stone, a language-learning software company. He has experience with both front and back-end development and works primarily in Python, Ruby, and JavaScript. He attended the first RailsConf and the most recent PyCon US. He received an MBA and a BA in Computer Science and Spanish from Eastern Mennonite University.
    Kevin Burnett
    Software Developer

    Private GitHub access demands keys. To access private GitHub repos, generate an SSH key locally first. Add the public key to your GitHub account, then use the SSH clone URL which uses that key to authenticate you. This sets up a trusted pathway for smooth cloning.

  6. Click the source location (typically a URL starting with “https” or “ssh”) and hit Ctrl + C or Cmd + C to copy.
  7. The “git” command tells the command line you are using a Git function, and “clone” tells it to clone the location following the command. Paste or type out the source location after the command.
    • In order to paste into the Windows command line, you have to right-click and select “Paste” from the context menu. This is not necessary in the Mac or Linux Terminal.
  8. The cloning process will begin and display its progress in the command line. You will be notified when the process in completed by a message in the command line.
  9. Advertisement
Method 2
Method 2 of 3:

Using the Git GUI

PDF download Download Article
  1. Go to https://git-scm.com/downloads and select the download for the platform you are using.
  2. Navigate to a location of your choosing your computer. Then right-click (or Ctrl + click) and select “New Folder”.
    • For simplicity, it may be best to create your first repository folder on the Desktop.
  3. Go to the github (or whichever git product) page of the repository you are trying to clone. The source location of the repository will be displayed on the repository page.
    • The exact location of the source location will vary depending on which repository site you are using, but they are usually located near the top for easy access. Look for a URL.
  4. Click the source location (typically a URL starting with “https” or “ssh”) and hit Ctrl + C or Cmd + C to copy.
  5. This program is installed along with the git tools. Instead of booting into a text command line, you will see a window with clickable buttons.
  6. This is the first option on the boot splash screen.
    • You can also select “Clone” from “Repository” dropdown menu.
  7. Paste or type the source location into this field.
  8. Enter the path to the repository folder you created.
    • You can also click “Browse” to search for the folder without having to type it out.
  9. The GUI will display your progress and notify you once the clone is complete.
  10. Advertisement
Method 3
Method 3 of 3:

Using Visual Studio

PDF download Download Article
  1. Go to the github (or whichever git product) page of the repository you are trying to clone. The source location of the repository will be displayed on the repository page.
    • The exact location of the source location will vary depending on which repository site you are using, but they are usually located near the top for easy access. Look for a URL.
  2. Click the source location (typically a URL starting with “https” or “ssh”) and hit Ctrl + C or Cmd + C to copy.
  3. Visual Studio is common in Windows development environments, but is not free. You can download VS Express to get a stripped down free edition.
  4. This is located in the bottom of right-hand sidebar.
  5. This button is represented by the plug icon and is located in the top menu bar of the right sidebar.
  6. This is located in the “Local git repositories” section in the right sidebar.
  7. Once in the field, the “Clone” action button will become clickable.
  8. This button is located below the source location field. Once clicked a progress bar will appear displaying the clone process. The process is complete once the bar is filled.
    • Cloned repositories are automatically cloned to a local directory in your visual studio directory. [2]
  9. Advertisement

Expert Q&A

Search
Add New Question
  • Question
    How do I create a new folder in a GitHub repository?
    Kevin Burnett
    Software Developer
    Kevin Burnett is a Software Developer with over 20 years of professional experience. He works for SpiffWorkflow, a Python Process Automation tool for organizations. Prior to SpiffWorkflow, he spent the majority of his career at Rosetta Stone, a language-learning software company. He has experience with both front and back-end development and works primarily in Python, Ruby, and JavaScript. He attended the first RailsConf and the most recent PyCon US. He received an MBA and a BA in Computer Science and Spanish from Eastern Mennonite University.
    Software Developer
    Expert Answer
    Creating folders in the GitHub repository is very similar to creating files in a Git repository, so basically, when you have the GitHub repository cloned locally on your computer, you can just add a folder on your computer within that directory. Then you can add it using the git add command and subsequently commit and push it back up. The only caveat is that you can't actually add a folder to GitHub unless there are a lot of files inside of it. So when you do create that folder, just make sure you add at least one file inside of it, and then it works exactly like adding a file.
Ask a Question
      Advertisement

      Tips

      • For cloning a remote host git clone, use the “username@host:/path/to/repository” format after “git clone”. [3]
      • Use git pull to update instead of re-cloning. Save re-cloning for situations where you are having severe merge or compiler issues.
      • If you move your repository directory, make sure you make the proper adjustments to the path when you attempt to access it in the command line.
      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Name
      Please provide your name and last initial
      Thanks for submitting a tip for review!
      Advertisement

      Expert Interview

      Thanks for reading our article! If you’d like to learn more about computer programming, check out our in-depth interview with Kevin Burnett .

      About This Article

      Thanks to all authors for creating a page that has been read 69,582 times.

      Is this article up to date?

      Advertisement