Closed DanChaltiel closed 2 years ago
Can you run gitcreds::gitcreds_list_helpers()
?
It is already written in my post 😊
Right. What is your git version?
Can you run this from a terminal/cmd window, from the project's directory:
git credential fill
url=https://github.com
You need type in the url=https://github.com
part without a prompt and then press ENTER twice. Does this print your PAT? The output should look like this:
protocol=https
host=github.com
username=PersonalAccessToken
password=<your GH PAT>
Thanks for your help, here is my version of git:
system("git --version", intern = TRUE)
[1] "git version 2.12.0.windows.1"
BTW, I'm using GitHub Desktop if it matters somehow.
For the credentials, running in a windows console, it fails:
F:\GITHUB\crosstable>git credential fill
url=https://github.com
warning: invalid credential line: ?
fatal: unable to read credential from stdin
But as with others, it works in a git Bash, even if there is still an error in my case:
Dan@DESKTOP-win10 MINGW64 /f/GITHUB/crosstable (main)
$ git credential fill
url=https://github.com
fatal: AggregateException encountered.
Une ou plusieurs erreurs se sont produites. /*meaning "one or several errors happened"*/
protocol=https
host=github.com
username=PersonalAccessToken
password=ghp_<my GH PAT>
I guess this means that gitcreds_set()
worked and that the problem lies in gitcreds_get()
somehow.
EDIT:
The output of git config --list
prints two lines credential.helper=manager
and credential.helper=wincred
while gitcreds::gitcreds_list_helpers()
returns only the first, hence manager
.
gitcreds needs at least git 2.12.1 to work on Windows, see "git versions" at https://gitcreds.r-lib.org/reference/gitcreds_get.html or in the manual.
If you can update git to a recent version, that is the best, 2.12.x is not supported any more even by git.
Oh OK thanks a lot for your patience! I updated git and it works now, I'm sorry I should have thought about it.
Maybe a quick check to system("git --version", intern = TRUE)
might belong in gitcreds::gitcreds_set()
?
Maybe a quick check to
system("git --version", intern = TRUE)
might belong ingitcreds::gitcreds_set()
?
Parsing the git version from the output is surprisingly hard, unfortunately, there are many variations.
Hi,
I'm experiencing a bug when using
gitcreds::gitcreds_set()
. This looks like https://github.com/r-lib/gitcreds/issues/30 but reading it unfortunately did not help me.Coming from https://usethis.r-lib.org/articles/git-credentials.html#get-a-personal-access-token-pat, I created a PAT from the GitHub web interface and then tried to set it using gitcreds:
While there is no error in
gitcreds_set
, it seemed to have no effect.I'm not really a git expert so I have no clue how to investigate this bug, so feel free to ask for anything.
Here are more info: