5

I made an R package which is hosted on my employer's instance of Atlassian Stash. I have been telling other users to clone the repo and then use devtools::install("<path-to-repo>") to install the package.

How can I have users install the package without cloning the repository? Can I do this without hosting the code somewhere more accessible?

ClaytonJY
  • 1,244
  • 10
  • 21
  • you could just email users a zipped file of the package files, and do `R CMD INSTALL ` from the command line in linux, or other method of building packages from scratch in other OSes. – Alex Jul 07 '15 at 23:29
  • @Alex those solutions simply replace the the `devtools::install` command above, while still necessitating a prior step of obtaining the files from somewhere. I love the simplicity of installing from github with `devtools::install_github`, and my solution below gives a similar one-step process. – ClaytonJY Jul 08 '15 at 16:41

1 Answers1

6

Using this solution as a starting point, I discovered that you can use devtools with a Stash ssh url:

devtools::install_git("ssh://git@stash.yourdomain.com:1234/project/repo.git")

That will install from the latest commit on the master branch. You can also install a specific branch:

devtools::install_git("ssh://git@stash.yourdomain.com:1234/project/repo.git", branch="develop")

or tag:

devtools::install_git("ssh://git@stash.yourdomain.com:1234/project/repo.git", branch="v1.0")

(note you don't need the tags/ prefix when using a tag)

This will only work if you have SSH keys for your machine on your Stash account. Using the http clone url will not work, because you can't authenticate properly.

ClaytonJY
  • 1,244
  • 10
  • 21