Push an RStudio Project to a GitHub Repository
This lesson is called Push an RStudio Project to a GitHub Repository, part of the Using Git and GitHub with R course. This lesson is called Push an RStudio Project to a GitHub Repository, part of the Using Git and GitHub with R course.
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
Open the
local-first
project you created previouslyPush your
local-first
project to GitHub using theuse_github()
function from theusethis
package
Have any questions? Put them below and we will help you out!
Course Content
26 Lessons
1
Why Use GitHub vs Dropbox, Google Drive, Box, etc?
03:15
2
Dealing with Common Problems: Can't Pull Code from GitHub
08:05
3
Dealing with Common Problems: Merge Conflicts
05:24
4
Dealing with Common Problems: Can't Push Code to GitHub
04:38
5
Let's Keep Bad Things from Happening in the First Place
02:45
You need to be signed-in to comment on this post. Login.
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:
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 • 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 • 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 ?
Mike LeVan • January 16, 2025
Hi. Question about the repository name. Basically, what is it based on? Is it the name from the Files tab, "local-first.Rproj"? I have a script called "Practice-Repositry-1" and when I ran the command to create a new repository, the repository created was "project" and the only place I saw this used was in the Files tab with the file "project.Rproj".
I was playing around and changed "project.Rproj" to "BLAH-1.project" and tried to create a repository for that, but I got an error that says, " Repo "levanj/project" already exists on "github.com".
Is there an easy way to change the names? Thanks.
David Keyes Founder • January 17, 2025
The repo name is based on the folder name that houses the materials, not the .Rproj file. If you want to change the name of your repo, go to settings in any repo and then you'll see the option to rename at the top. Let me know if that helps!
Mike LeVan • January 17, 2025
Thanks. That does help. This (/cloud/project) appears to be the default when using Posit Cloud.
Does this mean any new project will have "project" as. the default repository name? Is there an easy way to point it to a different repository? I have played around a bit with changing the working directory but it doesn't seem to create a new repository when I do this.
I guess my question is how to get Post Cloud to point to a different repository other than "project"? I tried changing the working directory to something like /cloud/project/BLAH but it doesn't seem to be working.
Apologies for the questions. I'm a Git newbie.
David Keyes Founder • January 17, 2025
I'm not sure I'm completely following. Could I have you record a quick video so I can see what you're asking?
Mike LeVan • January 17, 2025
Hi. Recording sent. Apologies that since I am new to this I am probably not asking the correct questions or using the proper vernacular.
David Keyes Founder • January 18, 2025
Just reviewed your video, which was helpful. I didn't realize you were using Posit Cloud. Unfortunately, I don't know the answer to how you would do this. I would consider reaching out to Posit to ask. The one thing I do see within Posit Cloud is the ability to start a new project from a GitHub repository. So you might consider creating your project there and then adding to Posit Cloud. I just tested and that does work. It will still show up as Cloud > project, but I think it should work. I synced this repo to Posit Cloud and here's what I see. Hope this helps!