gitcreds::gitcreds_set doesn't store credentials
llrs opened this issue · 7 comments
This is a strange effect and I'm not sure if this is the right place to report it, maybe it is better on renv:
When opening a project A (in rstudio) coming from a project B that uses renv and use gitcreds::gitcreds_set()
to store credentials on project A, the credentials are not stored and are missing the next time I open project A.
My solution, open project A directly and then use gitcreds::gitcreds_set()
Weird indeed. Do you have some git config files in either projects?
@kevinushey does renv do anything with git config files?
Aside from .git/config I don't have anything else that I'm aware, and I don't have anything special on them.
project A:
1 [core]
2 bare = false
3 repositoryformatversion = 0
4 filemode = true
5 logallrefupdates = true
20 [commit]
21 gpgsign = false
project B:
1 [core]
2 bare = false
3 repositoryformatversion = 0
4 filemode = true
5 logallrefupdates = true
The missing lines look normal remotes and branch settings
@llrs What OS is this, and which credential helper do you use? Can you run gitcreds::gitcreds_list_helpers()
from both projects?
Mmh, happened in another repo and even if I opened from the system it didn't detect the git credentials. So maybe it is something on my git configuration. Perhaps it is related to having set usethis.protocol = "ssh"
in options? Because when I use gitcreds_get() I see:
<gitcreds>
protocol: https
host : github.com
username: PersonalAccessToken
password: <-- hidden -->
on ~/.giconfig I have:
[user]
name = llrs
email = redacted@gmail.com
signingkey = *redacted*
[push]
default = simple
[pull]
rebase = true
[core]
excludesfile = ~/.gitignore
[gpg]
program = gpg
[commit]
gpgsign = false
[credential]
helper = cache
I couldn't find a ~/.git-credentials file (I'm on linux, Ubuntu 20.04) so no surprise it couldn't find the authentication. It seems like they are not properly stored. Tried to debug it but I was lost at git_run("approve")
.
git version 2.25.1
gitcreds::gitcreds_list_helpers():
Project A: cache
Project B: cache
Project C: cache
[closed by mistake]
git version 2.25.1
gitcreds::gitcreds_list_helpers():
Project A: cache
Project B: cache
Project C: cache
The cache
helper forgets the credentials after 900s by default. You can pass an argument to increase that, see https://git-scm.com/docs/git-credential-cache
Oh, I thought this is something I should do once on a computer¹. Seems like a misunderstanding of what gitcreds does. Closing the issue then
git manages the credentials, gitcreds just asks git to hand them over. So this is up to git, not gitcreds.
Yes, the default git credential helpers on macOS and Windows keep the credentials in the system credential store, so you only need to do this once if you use them.
On Linux there might not be a system credential store, and the default git credential helper does not use it, even if there is one.