I am teaching collaboration with git and using Rstudio to do it.
Students create a GitHub account and generate a PAT (special purpose password required by GitHub). When they do the first thing that needs authentication (usually a git push) Rstudio helpfully pops up a Username/Password window.
If I understand correctly, the user/pass combo is stored somehow. Does anyone know how how the git user/pass is stored?
In particular, the Rstudio server we are using seems to need to ask for the user/pass quite frequently. Not every time, but somewhat randomly. Seems more frequent for some than others?
Are there server (or git) configuration variables that are relevant here? Is this governed by git config credential.helper 'cache --timeout=3600' or similar?
Feel free to point into the codebase
Note that I'm not using the (very cool) usethis R based packages (idea is to keep git knowledge generic, not linked to R per se), those are described here: https://happygitwithr.com/https-pat.html. I'm going for the "organic git use" approach.
On a local Windows machine, git credentials are often stored in the credential manager if passwords are used. This might explain why it does not expire as fast as in the cloud.
I varied the number from 1 to 20 and confirmed that at 1 the pop-up comes up every time. At 20, I had to wait 20 seconds between git push commands to make it pop-up.
Seems like the server system that I am on doesn't have this set at --system level, so the default would be 15m. This explains why it felt random: some students were running commands within that 15m window (and resetting the counter) but others were not (and therefore the counter was expiring).
Would be great to add this to the pop-up window:
Reduce frequency of this pop-up by setting the credential.helper gitconfig var using `git config --global credential.helper 'cache --timeout=LENGTH_IN_SECONDS'`