I use a corporate laptop, and have set my HOME variable to my Documents directory (for easier backup/restore) using the User Accounts -> "change my environment variables" (User Variables) dialog box. RStudio picks this up (
Sys.getenv("HOME")) gives me
C:\Users\MyName\Documents, but the Terminal pane does not (it returns
C:\Users\MyName). This is mostly a problem because the RStudio GUI git commit operation complains that it cannot find my user.name configuration setting, which is in fact in the
git --global config file under my HOME directory and git at the standard command line can access it.
Can I get MINGW to pick up the user environment variables? If not, where would I configure the environment variables for the RStudio Terminal?
> sessionInfo() R version 3.6.3 (2020-02-29) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363) Matrix products: default locale:  LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252  LC_MONETARY=English_United States.1252  LC_NUMERIC=C  LC_TIME=English_United States.1252 attached base packages:  stats graphics grDevices utils datasets methods  base loaded via a namespace (and not attached):  Rcpp_1.0.7 magrittr_2.0.1 knitr_1.33  hms_1.1.0 odbc_1.3.2 tidyselect_1.1.1  bit_4.0.4 R6_2.5.0 rlang_0.4.11  fansi_0.5.0 blob_1.2.1 dplyr_1.0.7  tools_3.6.3 xfun_0.23 utf8_1.2.1  DBI_1.1.1 htmltools_0.5.1.1 ellipsis_0.3.2  assertthat_0.2.1 yaml_2.2.1 bit64_4.0.5  digest_0.6.27 tibble_3.1.2 lifecycle_1.0.0  crayon_1.4.1 dnvglsolardata_0.2.4 purrr_0.3.4  vctrs_0.3.8 bitops_1.0-7 RCurl_1.98-1.3  glue_1.4.2 evaluate_0.14 rmarkdown_2.9  pillar_1.6.1 compiler_3.6.3 generics_0.1.0  pkgconfig_2.0.3
Edit: I found Using the RStudio Terminal in the RStudio IDE – RStudio Support, and my setting is default (use Git Bash from Git for Windows) but when I independently start Git Bash the environment variables are inherited correctly. I also tried changing the Terminal to Command but the environment variables are still wrong when that setting takes effect.