Git Repo自动提交和推送 [英] Git Repo Auto-commit and Push

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

问题描述

我有一个场景,其中有一个用户直接访问文件的回购站,他们不知道git是否存在,并对本质上是文本文件进行了更改。



<我有这个回购克隆。因此,在提交时,使用post-commit钩子将更改推送到克隆的repo。



现在,我已将克隆的回购作为裸回购。但是,我现在想要做的是在每次推送时都要运行脚本。该脚本将读取刚刚推送的文件的内容。这是否被视为提交?我可以再次使用post-commit钩子吗?



这可以在裸露的repo上完成吗?由于没有工作目录?我不明白我是否可以读取文件,如果回购是裸露的。

解决方案

是的,您可以使用钩子。但是,您必须使用较低级别的git命令从裸仓库检索提交树和文件。例如。 http://git-scm.com/book/ch9-2.html

I have a scenario where I have a repo where users access the files directly, they don't know git exists, and make changes to what are essentially text files.

I have that repo cloned. So when a commit is made, the changes are pushed to the cloned repo using the post-commit hook.

Now, I have the cloned repo as a bare repo. But, what I would like to do at this point is have a script run each time a push is made. That script would read the content of the file(s) that were just pushed. Is that treated as a commit? Can I again use the post-commit hook?

Can that be done on a bare repo? Since there is no working directory? I'm don't see how I could "read" the file if the repo is bare.

解决方案

Yes, you can use the hook. However, you must use lower level git command to retrieve the commit tree and files from a bare repo. E.g. http://git-scm.com/book/ch9-2.html

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

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