1

In gitolite I've set up a new repository on the server and able to clone it from my machine. As it's a web project I need the latest working copy at /var/www/my-project, so every push made by a developer will update the files there. How can I achieve that?

thanks

Dani Magen
  • 329
  • 3
  • 12

1 Answers1

0

The repos managed by gitolite are managed in ~/repositories

You can add your own hook in ~/repositories/yourrepo.git/hooks called post-receive hook in order to checkout, on each push, the index to a working tree of your choice (like /var/www/my-project)

See for instance "how to process files on a branch in post-receive hook in git" (which can even check for which branch is pushed).

The checkout uses:

git checkout --work-tree=/var/www/my-project
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250