Interact with GitHub
Overview
Teaching: 5 min
Exercises: 10 minQuestions
How to sync your files with GitHub
How to get remote changes on your local machine?
Objectives
Pushupdates to GitHub
Pullupdates from GitHub
Push changes to GitHub
In the previous episode, we explored the difference in between the local commit history and the commit history on the GitHub remote.
Rstudio gives you a warning about the status of your local commits versus those stored on GitHub.

Rstudio note on
ahead ofIf the Git pane displays your branch is ahead of ‘origin/master’ by X commits, this is actually providing you a warning message saying there is no backup of these commits!
In order to store these changes on GitHub as well, we have to push our changes to GitHub.
Push to GitHub
- Click push in the git pane
- Go to your repository on GitHub to verify the commits and file contents
Store credentials
It is a tedious task to retype the password each time you want to push anything to GitHub. Luckily, you can store your credentials when using https.
Configure password
- Click on the
morebutton in thegitpane and selectShell- Type
git config --global credential.helper store- Type
exitto quit the shell
Pull changes from GitHub
When working from different computers or when you adapted some text online in GitHub, it is important to integrate these adaptations on your local computer. To do so, you can pull changes from Github.
Pull changes from GitHub
- Update the
README.mdfile online and commit the changepullthe changes to your local machine- Open the
README.mdfile in Rstudio and check if the file has changed.
Key Points
Pushour code to GitHub andpullyour code from GitHub