1.1.1 • Published 9 years ago

git-sync v1.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
9 years ago

git-sync

sync a remote git url to a local dir at a branch

install

with npm installed, run

npm install --save git-sync

example

var gitSync = require('git-sync')

var cronJob = gitSync({
  remoteUrl: 'https://github.com/holodex/git-sync',
  localDir: __dirname + '/dir',
  branch: 'master',
  cronTime: '* */15 * * * *'
}, function (err, commit) {
  console.log(err, commit.id())
})

api

var cronJob = gitSync(options, cb)

possible options are:

  • remoteUrl: a url to a remote git repository
  • localDir: a path to a local directory to store the git repository
  • branch: an optional String to specify the name of a git branch
  • cronTime: any CronTime format supported by cron
  • noCertificateCheck: a boolean for whether or not to disable HTTPS certificate checking

cb is a function that will be called every time there is an error or after the git repository is updated with a new commit. it will be called node-style, with an Error (if any) as the first argument and a NodeGit Commit (if any) as the second argument.

cronJob returned by gitSync() is a CronJob which can be .stop() or .start().

faq

https

if using an HTTPS url (https://github.com/holodex/git-sync) and you receive the following error:

Error: The SSL certificate is invalid

then set the noCertificateCheck option to true.

ssh

if using an SSH url (git@github.com:holodex/git-sync) and you receive the following error:

Error: authentication required but no callback set

then post in this issue as it's not yet implemented. pull requests welcome! :)

1.1.1

9 years ago

1.1.0

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago