Skip to content
R for the Rest of Us Logo

Using Git and GitHub with R

Push an RStudio Project to a GitHub Repository

Transcript

Click on the transcript to go to that point in the video. Please note that transcripts are auto generated and may contain minor inaccuracies.

Your Turn

  1. Open the local-first project you created previously

  2. Push your local-first project to GitHub using the use_github() function from the usethis package

Have any questions? Put them below and we will help you out!

You need to be signed-in to comment on this post. Login.

Elan Sykes

Elan Sykes • November 12, 2021

I set my github PAT up without a problem a while ago but returning to this (and catching up on some long-delayed lessons here) I can't connect to github. I get the error message "Error: GitHub PAT must have one of these forms:

  • 40 hexadecimal digits (older PATs)
  • A 'ghp_' prefix followed by 36 to 251 more characters (newer PATs)"

When I check on github the PAT is still the one I set up, so I'm not sure how to fix this.

Yuan Liu

Yuan Liu • March 1, 2023

Hi Dave, I am trying to push a local R project to Github. My goal is to push this R project currently located on my PC only to Github, and then pull it to my MacBook. I believe I have set up PAT correctly in R Studio on both the PC and the MacBook.

I used: usethis::use_github()

I got the error (without showing other actions that were actually successful): Error in libgit2::git_remote_push : failed to receive response: A security error occurred

Googling the error message hasn't gotten me anywhere. Could you share insights on what the "security error" might have been?

Zain Asaf

Zain Asaf • June 12, 2023

Hi David and Charlie, I am working on something from week 10. I wanted to post the gist for the code as I am getting an error message. I wanted to post the code to an existing project that I have called "zain_rin3-project' However, when I attempt to push the project to github, I get the following error message "Error: Repo 'zainasaf/zain_rin3-project' already exists on 'github.com'. I assume it is possible to push the code to an existing project, and we do not have to create a new project in github each time we post new code. Is there a step that I am missing ?