Open czeildi opened 5 years ago
Hmm, I did not install gpg4win, and got something different. In my case, it appears that the gpg
package picks up on the binary of gpg that came installed with R, whereas my shell (git bash) wants to use the version of gpg that it comes with.
I tried setting the home
and path
in gpg_restart
, but it didn't appear to be successful, and gpgconf
remained NA?
library(gpg)
#> Found GPG 1.4.23. Using keyring: NA
gpg_info()
#> $gpgconf
#> [1] NA
#>
#> $gpg
#> [1] "C:\\Program Files\\R\\R-3.6.0\\library\\gpg\\bin\\gpg.exe"
#>
#> $version
#> [1] '1.4.23'
#>
#> $home
#> [1] NA
#>
#> $gpgme
#> [1] '1.11.1'
home <- "C:\\Users\\hye\\.gnupg"
path <- "C:\\Program Files\\Git\\usr\\bin\\gpg.exe"
gpg_restart(home = home, path = path)
#> gpg (GnuPG) 1.4.23
#> Copyright (C) 2015 Free Software Foundation, Inc.
#> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
#> This is free software: you are free to change and redistribute it.
#> There is NO WARRANTY, to the extent permitted by law.
#>
#> Home: C:/Users/hye/AppData/Roaming/gnupg
#> Supported algorithms:
#> Pubkey: RSA, RSA-E, RSA-S, ELG-E, DSA
#> Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
#> CAMELLIA128, CAMELLIA192, CAMELLIA256
#> Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
#> Compression: Uncompressed, ZIP, ZLIB, BZIP2
gpg_info()
#> $gpgconf
#> [1] NA
#>
#> $gpg
#> [1] "C:\\Program Files\\R\\R-3.6.0\\library\\gpg\\bin\\gpg.exe"
#>
#> $version
#> [1] '1.4.23'
#>
#> $home
#> [1] "C:\\Users\\hye\\.gnupg"
#>
#> $gpgme
#> [1] '1.11.1'
Created on 2019-07-07 by the reprex package (v0.3.0)
It looked like the key that was being used by git in the shell was also different, so I suspect configuration needed to be done there to also use the same keyring and gpg binary as what the gpg
R package picks up?
@ha0ye it is expected that the R packages comes with a gpg.exe
in case you don't have any. And so does git for windows.
I'm surprised that they use a different home directory and don't share settings/keys though. Where are the git for Windows gpg settings/keys being stored?
Here's what I see when running gpg --version
in the git bash shell.
gpg (GnuPG) 2.2.11-unknown
libgcrypt 1.8.4
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Home: /c/Users/hye/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2
Summary: to sign commits with gpg from Rstudio git GUI I need to run gpg_restart with setting
home
every time.Details:
I am trying to test
ropsec
(https://github.com/ropenscilabs/ropsec), especially the commit signing part building ongpg
on Windows. I have never used Windows for either regular R scripts or R package development before, only mac and linux so I am not sure what is an issue to be fixed on my computer and what might be fixed in gpg.From what I can see the issue is that gnupg version by default in gitbash, Rstudio console and when I try to commit from the Rstudio git GUI are different things.
I managed to make things work by first installing gpg4win (before that rstudio found 1.x gpg, after that 2.x) and then in Rstudio running
gpg_restart(home = "C:\\Users\\Ildi\\.gnupg")
. This seems cumbersome, though, as it needs to be run every time.Appendix result of
gpg_info
beforegpg_restart(home = "C:\\Users\\Ildi\\.gnupg")
:after: