Reputation: 12898
I'm trying to use nodegit to open up a git repository with the following code:
var git = require('nodegit');
git.Repo(repoPath, function(error, repository) {
if (error) throw error;
}
This gives me the following error, no matter what I assign the repoPath
variable:
git.Repo(repoPath, function(error, repository) {
^
Error: git_repository is required.
I have tried path to local folder, I have tried path to local folder, including the .git
folder, I have tried a remote repo using url. No nothing.
Can anyone help out?
I'm using
node v0.10.24
nodegit v0.1.4.
git 1.9.0.msysgit.0
win 8.1 pro 64bit
Upvotes: 4
Views: 1124
Reputation: 5277
You need to use the open
method to open the repository.
git = require('nodegit')
git.Repo.open('some-path', function(err, repo) {
console.log(repo.path())
}
Using a remote path won't work as git works locally. If you'd like to clone, there's a clone
method available which will also call a function once the clone has been performed, like
git = require('nodegit')
git.Repo.clone('git://some-host/path', 'local-path', null, function(err, repo) {
console.log(repo.path())
}
Upvotes: 6