当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to use command 'git clone url' in nodejs server

问题描述:

I am trying to clone a git url in NodeJs(Server side) Application. Do any one have idea on how to do so. I wanted to run the git clone command through node server javascript file.

网友答案:

You can try using a the nodegit plugin:

https://github.com/nodegit/nodegit

Sample (for more info see http://www.nodegit.org/api/):

var clone = require("nodegit").Clone.clone;

// Clone a given repository into a specific folder.
clone("https://github.com/nodegit/nodegit", "tmp")
  .then(function () {
    // Repo is available in "tmp"
  });
分享给朋友:
您可能感兴趣的文章:
随机阅读: