Gitlab Enterprise with 2FA

Description of issue -
I'm using GitLab Enterprise. Since, we have 2 Two-Factor Authentication (2FA) enabled, I am using Access token to connect my Visual Studio and Source tree IDE. However, with Rstudio, it does not prompt me to enter any "Access token" or password.
When I open the cloned folder in Rstudio, I can see the git changes.
After opening the terminal from Rstudio, typing
git remote -v
The output shows the remote path. However, when I try to push or pull, I get an error. as below

/usr/bin/git push origin HEAD:refs/heads/main
ssh_askpass: exec(rpostback-askpass): No such file or directory
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights.
and the repository exists.

I understand that I need to enter an access token somewhere, but I'm not sure where I should enter it. I tried adding a line in the .Renviron file as below , but it did not work. Other than this Gitlab enterprise, regular Github works fine in Rstudio.


Any help is appreciated. Thank you

System Information:

  • RStudio Edition: (Desktop )
  • RStudio Version: 2022.07.1 Build 554
  • OS Version: mAcos
  • R Version: 4.2.0
  • sessionInfo():
    R version 4.2.0 (2022-04-22)
    Platform: x86_64-apple-darwin17.0 (64-bit)
    Running under: macOS Big Sur 11.3.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] Rcpp_1.0.8.3 magrittr_2.0.3 hms_1.1.1 odbc_1.3.3
[5] tidyselect_1.1.2 bit_4.0.4 here_1.0.1 R6_2.5.1
[9] rlang_1.0.2 fansi_1.0.3 blob_1.2.3 dplyr_1.0.9
[13] tools_4.2.0 vroom_1.5.7 utf8_1.2.2 cli_3.3.0
[17] DBI_1.1.2 ellipsis_0.3.2 assertthat_0.2.1 bit64_4.0.5
[21] rprojroot_2.0.3 tibble_3.1.7 lifecycle_1.0.1 crayon_1.5.1
[25] purrr_0.3.4 tzdb_0.3.0 tidyr_1.2.0 vctrs_0.4.1
[29] glue_1.6.2 compiler_4.2.0 pillar_1.7.0 generics_0.1.2
[33] pkgconfig_2.0.3

Referred here from

The Access token has to be added when cloning the repository.
Like below

git clone

TokenName is what you added while creating the token on the Gitlab instance.
Our repo is a custom enterprise git, so has a different domain name. Ideally, it will be or

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.