Get access to all lessons in this course.
-
Introduction to Git and GitHub
- What is Git? What is GitHub?
- Why Should You Learn to Use Git and GitHub?
- Update Everything
-
Git
- Install Git
- Configure Git
- Create a Local Git Repository
- Commits
- Commit History
-
GitHub
- GitHub Repositories
- Connect RStudio and GitHub
- Push an RStudio Project to a GitHub Repository
- Pull a GitHub Repository to an RStudio Project
- Keep RStudio and GitHub in Sync
-
Collaborating with Git and GitHub
- Why Use GitHub vs Dropbox, Google Drive, Box, etc?
- Dealing with Common Problems: Can't Pull Code from GitHub
- Dealing with Common Problems: Merge Conflicts
- Dealing with Common Problems: Can't Push Code to GitHub
- Let's Keep Bad Things from Happening in the First Place
-
Branches
- What are Branches and Why Should We Use Them?
- Branch Names
- How to Create Branches
- Using Pull Requests to Merge a Branch Into Main
-
Project Management with GitHub
- GitHub Issues
- How to Organize Issues
-
Wrapping Up
- Other Cool Stuff You Can Do with GitHub
Using Git and GitHub with R
Push an RStudio Project to a GitHub Repository
This lesson is locked
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
You need to be signed-in to comment on this post. Login.
Elan Sykes
November 11, 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.
David Keyes
November 11, 2021
Can you try just creating a new PAT and seeing if that works?
Elan Sykes
November 15, 2021
That worked!
David Keyes
November 15, 2021
Excellent!
Yuan Liu
February 28, 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?
David Keyes
February 28, 2023
That's a new one for me! Quick question: did your R project show up on GitHub?
Yuan Liu
March 1, 2023
It did, but it's empty. That is, only the repo's name is there. In case helpful, below is the entire return in R studio after I ran usethis::use_github():
ℹ Defaulting to 'https' Git protocol ✔ Setting active project to 'C:/Users/Yuan.Liu/Desktop/EcoMon2019SealScat' ✔ Creating GitHub repository 'yliu-atwork/ProjectName' ✔ Setting remote 'origin' to 'https://github.com/yliu-atwork/ProjectName.git' ✔ Pushing 'main' branch to GitHub and setting 'origin/main' as upstream branch Error in libgit2::git_remote_push : failed to receive response: A security error occurred ✔ Opening URL 'https://github.com/yliu-atwork/ProjectName'
David Keyes
March 1, 2023
Are you sure you're working in a project? This shows what you should see: https://show.rfor.us/GR4T9lXn
Yuan Liu
March 1, 2023
Morning Dave! Yes, I am in my project. Also, I set up a test R project on my PC and I failed to push that to Github as well (same error message). However, I am able to do it from my MacBook. Strange stuff! I reached out to our IT Helpdesk in case it's a security thing of my work PC. I'll share any follow-ups (may take a while). Meanwhile, please let me know if you think there is anything else I could try. Thank you!
Zain Asaf
June 11, 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 ?
David Keyes
June 12, 2023
I believe this is the same issue that we experienced before when we had our call together. Can you please record a quick video to show what you're seeing?