I'm trying to clone a Git repository that resides on my local drive into a new folder. So far, I've tried several modules, from which creationix/js-git seemed to be the most promising one.
The code to fetch I use is:
var source = '...',
target = '...';
var remoteRepository = git.remote('file://' + source),
localRepository = git.repo(target);
var options = {
onProgress: function (progress) {
console.log(progress);
}
};
localRepository.fetch(remoteRepository, options, function (err) {
if (err) { throw err; }
console.log('Done');
});
Unfortunately, this does not work, as js-git
complains about an unknown URL format, which relates to the file://
protocol being used. The same error appears when I remove the file://
portion.
I also tried to change git.remote
to git.repo
(as it's not an actual remote), but then I get:
TypeError: Object #<Object> has no method 'discover'
So, apparently js-git
does not support fetching from local repositories (or I was not able to find out how to do it).
Does anyone…
- …either know how to solve this using
js-git
, - or can suggest a viable alternative?
Any help is appreciated :-)