'Get Git username in R script
I’m trying to call the Git username of whoever is running the script in RStudio. I have tried system(“git config —-list user.name”) and system(“git config —-get user.name”) but no luck so far. Cheers
Solution 1:[1]
There are functions in git2r that might be useful: https://rdrr.io/cran/git2r/
For example to use R to retrieve git commits and the author using the following example code:
git2r::last_commit()
pth <- getwd()
lst_commit <- git2r::revparse_single(pth, "HEAD")
lst_commit$author
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jeremy Holden |
