I recently shifted to working on Linux from Windows on the same system. As a result, I had access to my repos locally (and did not need to clone from GitHub) but had to set up Git and configure it with RStudio, which is when I came across the issue of git authentication. On Windows, I believe I had only set everything up once in the beginning, and I usually did not need to authenticate at each push-pull. However, on Linux now, I am required to do so and it is becoming frustrating.
I initially tried a lot of things, such as using the terminal for git config --global ...
. I tried many of these solutions which I'd found online, but they didn't work for me. Eventually I discovered the option of using usethis
and gitcreds
to configure GitHub for RStudio. The commands all work and I explicitly run gitcreds::gitcreds_set("https://github.com")
and gitcreds::gitcreds_set("https://github.com/my-username")
. Once run, when I ask for the git credentials (usethis::git_sitrep()
) everything is dandy. However, when I enter a new session, things go back to square one and I have to repeat this process.
What could be the issue here, and how can I set my GitHub credentials globally for more than one session? Although caching into R environment is discouraged and disabled by default, since it is always mentioned as an (older) alternative to this method of configuration, I doubt that is the problem. I also doubt it's an OS issue.
System details
Linux Mint 19.3 Cinnamon 4.4.8
git version 2.17.1
R 4.1.2 (2021-11-01) -- "Bird Hippie"
RStudio 2021.09.2 Build 382 "Ghost Orchid" Release (fc9e2179, 2022-01-04) for Ubuntu Bionic