I
I
Ilya Izumskee2014-01-23 20:24:44
git
Ilya Izumskee, 2014-01-23 20:24:44

How to write a hook to update a git repository after adding files to it?

Hosted with Git. There is a central repository, the rep (master) is cloned from it to the www folder (the web server looks there). Some user files are periodically added to the www/files folder.
It is necessary to write a hook that, after each addition of a file to www/files, makes a commit and push to the central rep.
I'm still new to Git, so I'm asking for some advice.
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2014-01-23
@Izumskee

You want something weird. There is no such hook because it is not a hook. You can of course write a script like

cd /work/dir
git add -A
git commit -m "automatic commit"
git push origin master

and put in cron.
But this is an underwater rake - at some point there will be a conflict, and all automation will be covered.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question