Cannot get Git tab to show up in RStudio

349 Views Asked by At

I've looked through a bunch of links so far, but so far none of them seems to solve my issue with installing the usethis package or getting my Git tab to work in R. For context, my session_info is below and I have just downloaded R and RStudio (along with restarting my session from scratch):

setting  value
 version  R version 4.3.0 (2023-04-21 ucrt)
 os       Windows 11 x64 (build 22621)
 system   x86_64, mingw32
 ui       RStudio
 language (EN)
 collate  Chinese (Simplified)_China.utf8
 ctype    Chinese (Simplified)_China.utf8
 tz       Asia/Shanghai
 date     2023-05-23
 rstudio  2023.03.1+446 Cherry Blossom (desktop)
 pandoc   NA

─ Packages ─────────────────────────────────────────────────────────
 package     * version date (UTC) lib source
 cachem        1.0.8   2023-05-01 [1] CRAN (R 4.3.0)
 callr         3.7.3   2022-11-02 [1] CRAN (R 4.2.2)
 cli           3.6.0   2023-01-09 [1] CRAN (R 4.2.2)
 crayon        1.5.2   2022-09-29 [1] CRAN (R 4.2.2)
 devtools    * 2.4.5   2022-10-11 [1] CRAN (R 4.3.0)
 digest        0.6.31  2022-12-11 [1] CRAN (R 4.2.2)
 ellipsis      0.3.2   2021-04-29 [1] CRAN (R 4.2.2)
 fastmap       1.1.1   2023-02-24 [1] CRAN (R 4.3.0)
 fs            1.6.1   2023-02-06 [1] CRAN (R 4.2.2)
 glue          1.6.2   2022-02-24 [1] CRAN (R 4.2.2)
 htmltools     0.5.5   2023-03-23 [1] CRAN (R 4.3.0)
 htmlwidgets   1.6.2   2023-03-17 [1] CRAN (R 4.3.0)
 httpuv        1.6.11  2023-05-11 [1] CRAN (R 4.3.0)
 later         1.3.1   2023-05-02 [1] CRAN (R 4.3.0)
 lifecycle     1.0.3   2022-10-07 [1] CRAN (R 4.2.2)
 magrittr      2.0.3   2022-03-30 [1] CRAN (R 4.2.2)
 memoise       2.0.1   2021-11-26 [1] CRAN (R 4.3.0)
 mime          0.12    2021-09-28 [1] CRAN (R 4.3.0)
 miniUI        0.1.1.1 2018-05-18 [1] CRAN (R 4.3.0)
 pkgbuild      1.4.0   2022-11-27 [1] CRAN (R 4.2.2)
 pkgload       1.3.2   2022-11-16 [1] CRAN (R 4.2.2)
 prettyunits   1.1.1   2020-01-24 [1] CRAN (R 4.2.2)
 processx      3.8.0   2022-10-26 [1] CRAN (R 4.2.2)
 profvis       0.3.8   2023-05-02 [1] CRAN (R 4.3.0)
 promises      1.2.0.1 2021-02-11 [1] CRAN (R 4.3.0)
 ps            1.7.2   2022-10-26 [1] CRAN (R 4.2.2)
 purrr         1.0.1   2023-01-10 [1] CRAN (R 4.3.0)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.2.2)
 Rcpp          1.0.10  2023-01-22 [1] CRAN (R 4.2.2)
 remotes       2.4.2   2021-11-30 [1] CRAN (R 4.3.0)
 rlang         1.0.6   2022-09-24 [1] CRAN (R 4.2.2)
 rstudioapi    0.14    2022-08-22 [1] CRAN (R 4.3.0)
 sessioninfo   1.2.2   2021-12-06 [1] CRAN (R 4.3.0)
 shiny         1.7.4   2022-12-15 [1] CRAN (R 4.3.0)
 stringi       1.7.12  2023-01-11 [1] CRAN (R 4.3.0)
 stringr       1.5.0   2022-12-02 [1] CRAN (R 4.3.0)
 urlchecker    1.0.1   2021-11-30 [1] CRAN (R 4.3.0)
 usethis     * 2.1.6   2022-05-25 [1] CRAN (R 4.3.0)
 vctrs         0.5.2   2023-01-23 [1] CRAN (R 4.2.2)
 xtable        1.8-4   2019-04-21 [1] CRAN (R 4.3.0)

 [1] E:/R-4.3.0/library

When I run library(devtools), I consistently get the following message:

载入需要的程辑包:usethis

Which basically says I still need to install the usethis package. However, I have already installed this package, and it is clearly visible in my packages tab:

enter image description here

I have tried updating both usethis and devtools in that order and vice versa (along with redownloading RTools in case that would be helpful), but nothing seems to get this message to go away. I have no trouble running library(usethis) and running usethis:: plus whatever command in the package. Despite all this, I am unable to find the Git tab in R after using the use_git function as advised on this page. The only thing visible in the upper right pane is this:

enter image description here

What else do I need to do in order to get this tab to work?

Edit

The Tools -> Global Option -> Git/SVN path only shows this in RStudio:

enter image description here

Nor does it have the option for selecting Git here:

enter image description here

1

There are 1 best solutions below

1
goblinshark On

I found usethis didn't work well with my setup. What I do to get git working is go to Project > New Project > New Directory > New Project and make sure the "Create a git repository" box is ticked. Then when you open the project the git tab should show up.