gh-clone
git clone a repo with only username/repo, or if it's an NPM package you can use just the name of the project.
Last updated 2 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install gh-clone -g
SYNC missed versions from official npm registry.

gh-clone NPM version NPM monthly downloads NPM total downloads Linux Build Status

git clone a repo with only username/repo, or if it's an NPM package you can use just the name of the project.

Please consider following this project's author, Jon Schlinkert, and consider starring the project to show your :heart: and support.

Install

Install globally with npm

$ npm install --global gh-clone

CLI Usage

Clone a github repository:

$ gh-clone <repo> [options]
  • repo - one or more space-separated repository names
  • options options flags to pass to gh-clone

Examples

repository name

If the repository is a NPM package, you can pass the name only, and gh-clone will resolve the git URL from the library's package.json:

$ gh-clone isobject

owner/repo

Pass the github repository formatted as owner/repo:

$ gh-clone jonschlinkert/isobject

Options

Shortcut Flag Description
-c --cwd the current working directory (defaults to process.cwd())
-d --dest the local destination directory to clone the repository to
-b --branch the branch to clone

Note that if the --dest flag is used when cloning multiple repositories, the name of each repository will be appended to the dest value.

Examples

branch

Flags can be used in any order. If you want the dev branch of micromatch (when one exists):

$ gh-clone jonschlinker/micromatch -b dev

destination

If you want to save to the foo directory

$ gh-clone jonschlinker/micromatch -d foo

branch and destination

If you want to save the dev branch to the foo directory

$ gh-clone jonschlinker/micromatch -b dev -d foo

API Usage

Params

  • repos {String|Array}
  • options {Object}
  • callback {Function}: Optional, returns a promise if the callback is not passed.
  • returns {Promise}: if a callback is not passed.

Example

const clone = require('gh-clone');
clone('kind-of', function(err) {
  if (err) console.error(err);
});

// or
clone(['isobject', 'kind-of'])
  .then(function() {
    // do stuff
  })
  .catch(console.error)

About

<summary> Contributing</summary>

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

<summary> Running Tests</summary>

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
<summary> Building docs</summary>

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

Contributors

Commits Contributor
30 jonschlinkert
12 doowb
1 johno
1 theuves

Author

Jon Schlinkert

License

Copyright © 2018, Jon Schlinkert. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on May 28, 2018.

Current Tags

  • 2.0.1                                ...           latest (2 years ago)

13 Versions

  • 2.0.1                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.0.0                                ...           3 years ago
  • 0.5.0                                ...           4 years ago
  • 0.4.1                                ...           4 years ago
  • 0.4.0                                ...           4 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.3                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (2)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (7)
Dev Dependencies (3)

Copyright 2014 - 2016 © taobao.org |