You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
iotcat bfd861fd0b add revert 3 years ago
node_modules Committed by cron-git from Yimian-PC 3 years ago
LICENSE Update LICENSE 3 years ago
README.md Committed by cron-git from Yimian-PC 3 years ago
index.js add revert 3 years ago
ini.sh add gitadd-a to ini.sh 3 years ago
package-lock.json Committed by cron-git from Yimian-PC 3 years ago
package.json Committed by cron-git from Yimian-PC 3 years ago
test-diff.js add diff 3 years ago
test.js Committed by cron-git from Yimian-PC 3 years ago

README.md

cron-git

crontab git task by nodejs

preparation

  • make sure Git was installed
  • at __dir exec the following command
git config user.name "YOUR USER NAME"
git config user.email "YOUR EMAIL"
  • execute ./ini.sh

usage

	var o = {
		dir: __dirname,
		debug: false,
		allowNotice: true,
		pull: (params, callback, err_callback) => pull(params, callback, err_callback),
		push: (params, callback) => push(params, callback),
		sync: (callback, err_callback, params_pull, params_push) => sync(callback, err_callback, params_pull, params_push),
		schedule: (time, callback, err_callback, params_pull, params_push) => schedule(time, callback, err_callback, params_pull, params_push)
	}

params_pull

	var params = {
		remote: {
			repo: 'origin',
			branch: 'master'
		},
		add: {
			path: './*'
		},
		commit: {
			message: "Committed by cron-git from "+ require('os').hostname()
		},
		pull_params: {}
	}

params_push

	var params = {
		add: {
			path: './*'
		},
		commit: {
			message: "Committed by cron-git from "+ require('os').hostname()
		},
		push_params: ['-u', 'origin', 'master']
	}

License

Apache-2.0