FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

TypeError: Cannot call method 'clone' of undefined · Issue #91 · nodegit/nodegit · GitHub

Repository navigation

TypeError: Cannot call method 'clone' of undefined #91

Description

Been following the examples from the readme and seems like there's something wrong:

Here's my example code:

var git = require('nodegit');

var path = '/tmp/';

git.Repo.clone("https://github.com/nodegit/nodegit.git", path, null, function(error, repo) {
  if (error) throw error;

  repo.getCommit('59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5', function(error, commit) {
    if (error) throw error;

    commit.getEntry('README.md', function(error, entry) {
      if (error) throw error;

      entry.getBlob(function(error, blob) {
        if (error) throw error;

        console.log(entry.name(), entry.sha(), blob.size() + 'b');
        console.log('========================================================\n\n');
        var firstTenLines = blob.toString().split('\n').slice(0, 10).join('\n');
        console.log(firstTenLines);
        console.log('...');
      });
    });
  });
});
git.Repo.clone("https://github.com/nodegit/nodegit.git", path, null, function(
         ^
TypeError: Cannot call method 'clone' of undefined
    at Object.<anonymous> (/Users/attila/Projects/node-testing/git-example.js:5:10)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:901:3

It is also not entirely clear how to try cloning a repository based on the docs. Could you add an example please that shows how to require the module properly and then how to clone a repo? Thank you.

Using the latest node as of today: v0.10.18

Activity

  1. nkallen commented on Sep 8, 2013

    Contributor

    Sorry, this is somewhat confusing and my fault. You need to depend on master

    "dependencies": {
      "nodegit" : "git://github.com/nodegit/nodegit.git#master"
    },
    

    If you want to use the latest API (which has clone).

    @tbranyen maybe we should publish the artifact now to avoid confusion?

  2. tbranyen commented on Sep 8, 2013

    Member

    @nkallen published

  3. attilagyorffy commented on Sep 8, 2013

    Author

    thanks for getting back to me guys. i'll try this tomorrow.

  4. nkallen commented on Sep 10, 2013

    Contributor

    We've actually now published an artifact, 0.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL