是否可以使用devtools::install_git()
从MS Windows上某个文件系统目录中的本地git存储库安装软件包?
这些示例仅演示如何从Web URL(例如install_git("git://github.com/hadley/stringr.git")
)进行安装。
在通过RStudio和devtools(CTRL + SHFT + L)加载的包中以及在git版本控制下(即,.git
存在子目录),我尝试了以下操作:
devtools::install_git(paste0("git://", getwd(), ".git"))
该函数返回此错误:
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'
所以我猜我只是得到了错误的文件系统URL?
我以前在MS Windows中也遇到过同样的问题,并且自己弄清楚了。例如,如果您有一个本地存储库,名为“ C:\ path \ to \ pkga.git”。
devtools :: install_git(“ C://path/to/pkga.git”)
关键是在路径“ C://path/to/pkga.git”中使用双斜杠。
希望适用于其他使用MS Windows的用户。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句