使用nodegit克隆repo时出错

时间:2018-01-26 11:25:10

标签: libgit2 nodegit

我试图用nodegit克隆一个repo,但我最终只克隆了.git目录。我的其他文件都没有被下载。我在控制台中遇到了这个错误:

Assertion failed: (t->cred), function on_headers_complete, file ../vendor/libgit2/src/transports/http.c, line 380. Abort trap: 6

我写的克隆回购的代码如下:

Git.Clone(this.options.remoteUrl, this.options.localDir, this.cloneOptions)
    .then((repo) => {
      if (repo instanceof Git.Repository) {
        console.log('Cloned');
        repo.checkoutRef('refs/head/master').then((reference) => {
          console.log('Checkout master completed');
          this.alreadyCloned = true;
          this.busy = false;
          cb(null, {});
        });
      } else {
        console.error('Failed to clone the repo');
      }
    })
    .catch((err) => {
      console.error(err);
      this.busy = false;
      cb(err);
    });

克隆选项:

this.cloneOptions = {
      fetchOpts: {
        callbacks: {
          certificateCheck() {
            return 1;
          },
          credentials() {
            return Git.sshKeyMemoryNew(
              options.username,
              options.publickey,
              options.privatekey,
              options.passphrase,
            );
          },
        },
      },
    };

节点版本:v8.5.0 操作系统:MacOS High Sierra(已编辑)

此外:

options.publickey,   // /Users/safa/.ssh/id_rsa.pub
options.privatekey, // /Users/safa/.ssh/id_rsa

提前致谢!

0 个答案:

没有答案
相关问题