Is it possible to use devtools::install_git()
to install a package from a local git repository located in some file system directory on MS Windows?
The examples only demonstrate how to install from a web URL (e.g. install_git("git://github.com/hadley/stringr.git")
).
From within a package loaded via RStudio and devtools (CTRL + SHFT + L) and under git version control (i.e., subdirectory .git
exists) , I tried the following:
devtools::install_git(paste0("git://", getwd(), ".git"))
The function came back with this error:
Downloading git repo git://C:/Users/Thyson/Documents/path/to/package/packagename.git
Error in git2r::clone(x$url, bundle, progress = FALSE) :
Error in 'git2r_clone': Malformed URL 'git://C:/Users/Thyson/Documents/path/to/package/packagename.git'
So I'm guessing I just got the file system URL wrong?
I had a same problem in MS Windows before and figured it out myself. For example, if you have a local repository called "C:\path\to\pkga.git".
devtools::install_git("C://path/to/pkga.git")
The key is to use double slash in the path "C://path/to/pkga.git".
Hope that works for other using MS Windows.