I'm wanting to clone a git repository using node.js command prompt. What are the commands I need to use to create a project area and then clone the repo to it?
2 Answers
Well, You can use shelljs or nodegit package.
Let me describe a way to use shelljs.
const shell = require('shelljs')
const path = process.cwd
shell.cd(path)
shell.exec('git clone https://github.com/<github-name>/<git-repos>')
Then it is a way to use nodegit.
const clone = require("nodegit").Clone.clone
const path = process.cwd
clone("https://github.com/<github-name>/<git-repos>", path)
.then(function () {
// Repo is available in `path`
})
git clone <repo url>doesn't work?