UC Merced -
Spring 2023

Data Science Research Biology: An intro to programming with R for ecology and evolution

Syllabus Schedule Computer Setup Course Materials About Help Contact

Creative Commons License

Cloning repositories with `git`


  • To “clone” a repository means to make a local copy of a repository from a remote copy of it.
  • you can clone any public repository on GitHub, from any user account or organization
  • In-class activity 1: Clone the GitHub repository markdown-cheatsheet to your computer using termnal commands:
    1. Go to the repository home on GitHub, at https://github.com/LunaSare/markdown-cheatsheet
    2. Copy the ssh address of the repo. You can find that by clicking on the green button that says “Code”: Git clone
    3. Go to your terminal and change directories (cd) to where you want to save the copy of the repo locally (aka in your computer). Note: Do not clone a repo inside another repository (e.g., your class repository). This creates problems. If you accidentally cloned the markdown-cheatsheet repo inside another repo in your computer, delete the markdown-cheatsheet repo with the command:
        rm -rf markdown-cheatsheet
      
    4. To create a local copy of the repo, use the command git clone "paste here the ssh address that you copied from the repo on GitHub".
    5. What happened on the terminal?
    6. List the contents of your current directory. Do you see a new folder there?
    7. Change directories to the new folder and list its contents. Compare this local list of files to the contents of the repo on Github. What do you note?