1  Creating a repository

First, you have to create a GitHub repository within the GHE organization on GitHub. You can do this here.

Choose a name for your repository, make it public if you’re data is not confidential/sensitive and click on “Create repository”. For now, you don’t need a README, .gitignore file or a license. You’ll add these at a later stage.

Once the repository is initialized, go back to RStudio and check if the devtools and usethis packages are installed. If not, please install/update them now as some of their functions are needed in the next steps.

Let’s create an R Project. Go to File > New Project > New Directory > R Package using devtools.

Copy and paste the name you chose for your GitHub repo as the directory name and select a location on your computer for the sub-directory.

Note

For the next steps we assume that you’ve already configured Git on your computer. If not, please make sure to do that before proceeding.

With your project set up locally and a new repository online, it’s time to connect the two. To do this, switch to the Terminal (the tab next to Console in RStudio) and run the following commands one after the other.

Warning

Replace REPO with the name of your newly created repository.

git remote add origin "https://github.com/Global-Health-Engineering/REPO.git" 

git branch -M main

git push -u origin main

If everything went well, you’re local repository (on your computer) should now be connected to the remote repository (on GitHub) which allows you to push and pull changes and to invite collaborators.