Git Path Question


I am a solo analyst and recently have found out about Version Control. I am attempting to connect R Studio with Github using this guide:

I have made it through the first few steps but I recently got stuck on Step 12.4. Specifically I am stuck on the part * Check “Staged” box for .

The image below is what I see on my Windows PC.

I noticed the files displayed in the Git Tab are located in C:\Windows
The Project I am working on is located in the path displayed in the picture.

System Information:

  • RStudio Edition: Desktop

R version 3.5.2 (2018-12-20)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252

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

loaded via a namespace (and not attached):
[1] compiler_3.5.2 backports_1.1.3 rprojroot_1.3-2 clisymbols_1.2.0 tools_3.5.2 fs_1.2.6 glue_1.3.0
[8] rstudioapi_0.9.0 crayon_1.3.4 Rcpp_1.0.0 usethis_1.4.0 git2r_0.24.0 packrat_0.5.0

I was wondering if it was possible to see my Project Files in the Git Panel? Thank you.



You probably have a Git repo in the C:\Windows directory. There's no .git folder in your project directory (at least, not one in your screenshot), so Git's found the nearest parent repo. Which is the C:\Windows one.

I would suggest getting rid of the repo in C:\Windows. If you have important work in it*, then clone it into its own project folder and use a lot of git mv in the command line to get the directories looking the way you want.

Then, open your project in R Studio, go to the command line window, and enter the command git init. That'll start a Git repo just for this project.

*Edit: By "important work in it," I mean committed in the repo. Obviously, your C:\Windows directory has a lot of important things. But you should feel safe to delete the repo when you won't lose any committed history. You can see what files are tracked by using the git ls-files command. It'll list all the files tracked by the Git repo.



Thank you so much for your reply!

This is actually the first Repo that I create. I also noticed that I get the following message when I open the Terminal Window within R Studio. I think this might be a possible cause of my issue.




Just figured it out! It is related to the error above. I was trying to access the UNC path which is not allowed in this case. I moved the location of my R Project file to somewhere on my C:\ drive and the problem was fixed. Thank you or your help!

1 Like


If your question's been answered (even if by you), would you mind choosing a solution? (See FAQ below for how).

Having questions checked as resolved makes it a bit easier to navigate the site visually and see which threads still need help.



closed #6

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.