title: How to clone github repo using node.js
body: <p>I need a reliable way to clone a github repo and paste it into a local directory using node.js and any necessary npm packages.</p>
  
  <p>This code is using the nodegit library and doesn't work to clone a github repo. it creates a single folder named .git and copies none of the files from the repo. I have tried several libraries most of which have extremely complicated code or don't work. This was working before but now isn't. (it goes on and off as it pleases). pls help, I need a reliable code that clones a github repo from url and pastes it into a local directory. Thank you.</p>
  
  <pre><code>var nodegit = require('nodegit'),
      path = require('path');
  
  var url = "https://github.com/atomicptr/dauntless-builder", //also tried https://github.com/atomicptr/dauntless-builder.git
      local = "C:/data",
      cloneOpts = {};
  
  nodegit.Clone(url, local, cloneOpts).then(function (repo) {
      console.log("cloning succesful!");
      console.log("Cloned " + path.basename(url) + " to " + repo.workdir());
  }).catch(function (err) {
      console.log(err);
  });
  </code></pre>
  
  <p>this code shows no errors, yet doesn't actually work to clone the repo.</p>