usethis, git, and GitHub
I have started getting into package development and finding the usethis
package to
be very useful. To smooth out some bumps with version control – really switching
back and forth between console and terminal for git commits. Note: I don’t like to
use the GUi’s Git tab – typing makes sure I really mean what I do.
The following is taken from the usethis
documentation.
library(usethis)
a. Initiate use of git (local)
usethis::use_git()
b. Default editor
use_git_config(core.editor = "nano")
c. Build connection with GitHub. This includes contact info and a personal access token. Finally git_sitrep() provides a report of how things are set.
use_git_config(user.name = "First Last",
user.email = "your.email@someplace.xyz")
create_github_token() ## will open up github to create a token
gitcreds::gitcreds_set() ## paste in the new token
git_sitrep()
With the steps above any R functions relying on git should work without an issue.
I did have one problem getting started where gitcreds::gitcreds_set()
could not find
git on my machine. To solve this I installed a updated version of git.