可以提交/推送github自动化? [英] Can commits/pushes to github be automated?

查看:117
本文介绍了可以提交/推送github自动化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将网站移至了Jekyll / GitHub Pages设置,并且有一个基于iOS的降价编辑器可以同步到Dropbox。目前,我正在研究如何弥补差距,并且在旅途中创建的文件自动提交并推送到GitHub仓库,但不确定从何处开始。是否有这样的可能?



(我没有在OSX上使用Automator的经验,但它似乎可能是一个选项,但我不能保证一台机器将一直保持清醒状态)

解决方案

使用cron应该可以做到。请注意,您需要为git设置基于密钥的身份验证,因此您不会在推送时提示密码。



(请注意,我已经使用了这些密码工具在Linux中,但它们也应该在OS X中工作。)



在某处创建脚本

 #!/ bin / sh 
cd / path / to / git / repo
git commit -a -m自动提交消息。 #提交所有更改
git push

使schript可执行文件为
chmod + x script.sh

运行 crontab -e 编辑您的cron文件,并添加 0 * * * * /path/to/script.sh 每小时执行一次脚本。



这也假定这个将成为唯一提交者。如果其他人从其他地方推送回购,您必须将这些更改合并到该克隆中,然后该脚本才能再次成功推送。



您还可以查看<
a $ {
$}

I've moved a site to a Jekyll / GitHub Pages setup and have an iOS-based markdown editor that syncs to dropbox. Currently I'm investigating ways to bridge the gap and have files created on the go automatically committed and pushed to the GitHub repo but unsure where to start. Is anything like this possible?

(I am not experienced in using Automator on OSX but it seems like it might be an option, though I can't guarantee that a machine will be awake all the time)

解决方案

Using cron should do the trick. Note that you'll need to have key-based authentication set up for git so you're not prompted a password on push.

(Note that I've used these tools in Linux, but they should work in OS X as well.)

Create your script somewhere

#!/bin/sh
cd /path/to/git/repo
git commit -a -m "Automated commit message." # commit all changes
git push

Make the schript executable
chmod + x script.sh

Run crontab -e to edit your cron file, and add 0 * * * * /path/to/script.sh to execute the script once per hour.

This also assumes that this will be the only committer. If anyone else pushes to the repo from elsewhere, you'll have to merge those changes to this clone before this script will push successfully again.

You could also check out Flashbake!

这篇关于可以提交/推送github自动化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆