1
我試圖使用Nodegit插件clone一些git回到一個名爲'tmp'的目錄中,這樣我就可以對實際文件夾進行操作(將其上傳到服務器)。這裏是我的代碼:Nodegit克隆不起作用?
var git = require('nodegit');
var repos = [some https repo urls]
var options = {
remoteCallbacks: {
certificateCheck: function() {
return 1;
}
}
};
for(i = 0; i<repos.length; i++){
git.Clone(repos[i], './tmp', options).catch(function(err) { console.error(err); });
}
它所做的就是爲分裂創建一個名爲「TMP」的空目錄,第二和刪除。我得到的錯誤是./tmp' exists and is not an empty directory
(但它不存在?)和authentication required but no callback set
。任何人知道如何解決這些問題?
我還沒有使用該項目,但看着文檔NodeGit似乎支持承諾,所以添加一個類似'git.Clone(repos [i],'./tmp).catch(function (err){console.log(err);});'看看發生了什麼問題。 – orbitbot
謝謝@orbitbot。我添加了錯誤情況並更新了錯誤信息。 – Bramt