git user/pass pop-ups when using git in Terminal window

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 :slight_smile:

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: I'm going for the "organic git use" approach.


I'm guessing that it is set via an environment variable? Looks like there is a binary gui that asks for the user/pass (something called askpass).


I think this post might help

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.

Hope this helps,

Indeed! Thanks, that works. I have run (in Terminal) (or editing ~/.gitconfig):

git config --global credential.helper 'cache --timeout=10000000'

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'`

However I think that text is defined in the askpass utility, which is why it is also hard to make that text reflect the need for a PAT and not GitHub password, as mentioned here

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.