0

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

torek
  • 448,244
  • 59
  • 642
  • 775
  • Rule 1: never use the [tag:linux] tag. :-) (See its tag popup information to see why.) On Linux, the Git credential manager environment is not that great and it's probably wiser to use ssh authentication instead, but if you must use https authentication, [try this search](https://stackoverflow.com/search?q=%5Bgit%5D+linux+credential+manager). – torek Feb 01 '22 at 04:26
  • @torek Oops! Thanks for the edit. Why would it be wiser to use SSH? I've also read of many users having trouble with SSH (in other aspects), so it seems like storing credentials using `credential.helper` is the only way... – Karthik Thrikkadeeri Feb 01 '22 at 05:49
  • ssh was designed from the ground up to be secure. It may have holes here and there but they generally get fixed pretty quickly (e.g., old style dss and rsa keys are no longer allowed or used). https credentials often store passwords in cleartext, and security bugs show up left and right with many every year. Nothing is perfect, but the track record of ssh is far better. – torek Feb 01 '22 at 08:09

0 Answers0