0

I'm trying to clone a repo with nodegit, but I end up with cloning nothing but .git directory. None of the my other files are being downloaded. And I got this error in the console:

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

The code I wrote to clone the repo is the following:

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);
    });

And the clone options:

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

Node version: v8.5.0 OS: MacOS High Sierra (edited)

Besides:

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

Thanks in advance!

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187
SafaOrhan
  • 690
  • 9
  • 19

0 Answers0