Skip to content

Instantly share code, notes, and snippets.

@mohammad-haji
Last active September 17, 2019 04:29
Show Gist options
  • Save mohammad-haji/090312963aeeb9bdf782717546df0647 to your computer and use it in GitHub Desktop.
Save mohammad-haji/090312963aeeb9bdf782717546df0647 to your computer and use it in GitHub Desktop.
npm install from public or private repos on GitHub or Bitbucket

Get the latest from GitHub, public repo:

$ npm install username/my-new-project --save-dev

GitHub, private repo:

$ npm install git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master $ npm install git+ssh://git@github.com/username/my-new-project.git#master

… or from Bitbucket, public repo:

$ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master --save-dev

Bitbucket, private repo:

$ npm install git+https://username:password@bitbucket.org/username/my-new-project.git#master $ npm install git+ssh://git@bitbucket.org/username/my-new-project.git#master

… or, if you published as npm package:

$ npm install my-new-project --save-dev

package.json

dependencies: { "my-new-project":"git+https://token:x-oauth-basic@github.com/username/my-new-project.git#master" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment