Skip to content

Forking & Cloning a GitHub respository

Samantha Csik edited this page Jun 28, 2023 · 1 revision

If you already have git configured on your computer and a GitHub account, you can fork and clone the cute-cats-dogs GitHub repository. First, what is forking and what is cloning?

  • forking a repo creates your own personal copy of a GitHub repository -- that is, creates a new copy under your GitHub account; repositories on GitHub are referred to as remote repositories
  • cloning a repo makes a local copy of a remote GitHub repository -- that is, download the contents of a repo on GitHub to your computer so that you can make changes (and eventually push those changes back to GitHub, if you'd like)

By forking and cloning this repository, you can quickly create a copy of all materials on your personal computer to work on. Saving, committing, and pushing your changes back to your copy (i.e. "fork") of the repo on GitHub gives you peace of mind that your work is safe on the cloud (fear not, keyboard coffee spills!). Steps for forking and cloning a repo are as follows:

  1. In your browser, open a GitHub repository that you'd like to fork/clone (if you're participating in the August 2023 NCEAS Roundtable, you'll want this repo: https://github.com/samanthacsik/cute-cats-dogs)

  2. Click the Fork button to create a copy under your own GitHub account

fork

  1. Once forked, click the green Code button, then copy the URL to your clipboard

clone

  1. Open RStudio and choose Project > New Project...

new_proj

  1. Choose Version Control...

version_control

  1. ...then Git

git

  1. Paste the URL in the Repository URL field, then press Tab to autofill the Project directory name (this should match the name of the repo exactly). You can Browse to select where you'd like to save the repository on your computer. Finally, click Create Project

paste_url

  1. Successfully cloning a repo means that all of the files on the remote repo are now be available on your local computer -- you should see those files in the Files pane:

rproj

Now we can work on/change, commit, and push files to our remote fork!

Clone this wiki locally