Hope this helps someone:
- Create empty repository on github (I will use name
rpackage
in this example) - Create package locally using devtools,
create("rpackage")
(this will create rpackage folder) - Create new project in RStudio (Create project from: Existing directory) and choose
rpackage
directory - In RStudio go to Tools/Shell... and type
git init
- Reopen the project (this will refresh the Git tab)
Start Git/More/Shell and type
git add *
git commit -m "first commit"
git remote add origin git@github.com:[username]/rpackage.git
git push -u origin master
Then you can refresh repository on github
. Now you can close (or even delete) your local project and next time you can start a new project Project/New project/Version Control/Git