How to: Use Github Desktop

Github desktop is one of the easiest ways to work with your analysis in Github in real time. This page will give you a quick guided tutorial on working with github desktop.

Make sure you are signed in to Github Desktop before starting.

Key terms used on this page can be found at the bottom.

Clone Repositories to Github Desktop

To work on a repository on your local machine, you need to clone it to Github desktop.

  1. In the File menu, click Clone Repository

  1. On the open window, use either the Github.com tab or the URL tab to find the repository you want to clone.
  • On the Github.com tab, start typing the repository name or search the dropdown menu for repositories in your personal account or the nwfsc enterprise organization.
  • On the URL tab, paste the URL of the github browser repository you want to clone.
  • Do not use the GitHub Enterprise tab

  1. Select the local directory into which you want to clone the repository. Next to “Local Path”, click Choose and navigate to the directory/folder where you want the github repository to live on your local machine.
  • This process will create a new folder in the directory you choose and call it your repository name. Location of the repository is up to you.!
    • The default directory will be in your Documents/Github folder on your computer and it will create a new folder called the name of the repository
    • You may choose to locate your repository folder somewhere in the project folder for which you are working
  • You may drag and drop the repository folder to another location after you initially clone it, but do not just move the files within the repo folder (there are hidden files that must go with it). Upon next working session, Github desktop will ask you to identify where you have moved the folder.

  1. At the bottom of the “Clone Repository” window, click Clone.

Repositories you have cloned to your local computer are shown in the drop down menu at the top left of your github desktop window. Toggle between them to work in different repositories.

If you are starting from scratch and making a new repository, follow the instructions How to: Create a github repository in enterprise, you will already have a cloned version on your desktop.

Working on Analyses with Github Desktop

  1. Toggle to the repository you want to work on (top left corner of Github Desktop)

  2. Check to see if you need to pull any changes from origin.

    If you or someone else made changes to your repository, the top bar of your github desktop will say Pull origin with a number next to it. Click this to update your local version of the repository to with any changes that were made. If your local repository matches the remote (github.com) repository, this space will say “fetch origin” and will not have a number next to it.

  1. In the center of github desktop, click Show files in Explorer (this may be slightly different on a mac) or navigate to the folder on your local machine that houses the github repository.

  1. Open you code in Rstudio or other program and work as you normally would!
  2. Save your file(s) when you are finished working.
  3. Navigate back to github desktop. Any edits you made to the repository folder should show up on the changes tab on the right.

  1. Type a commit message stating what work you did and click Commit to Main

    Make sure to commit your changes to main at least once a day, but the frequency is up to you.

  1. Once you make a commit, the top bar of your github desktop will now say Push origin and have a number next to it. Clicking this will push the changes you made on your local computer to your remote repository, backing them up and keeping a log of your changes.

    Always push to origin at the end of each work session, or once per day at minimum.

Key Terms

Clone: A copy of a repository that lives on your computer instead of a website’s server (cloning is the act of making that copy). When you make a clone, you can edit the files in your preferred editor and use Git to keep track of your changes without having to be online. The repository you cloned is still connected to the remote version so that you can push your local changes to the remove to keep them synced when you are online.

Commit: An individual change to a file, when you make a commit to save your work, Git creates a unique ID that allows you to keep record of the specific changes committed along with who make them and when.

Pull: Pull changes from the remote repository to your local copy so it is up to date.

Push: Send your committed changes to a remote repository on github.com

Remote repository: The “master copy” of your repository on github.com

Local Repository: The copy of your repository that is on your laptop/computer