Git- Automatic pull on production server?
(Source/Credits: https://dev.to/ian/git-automatic-pull-on-production-server-3en2)
title: Git- Automatic pull on production server? published: true description: tags: git, git pull, production
Hi,
I'm hosting my own Gitea server on which I have most of my web projects stored.
After pushing changes to a repo, I always have to connect to my shared hosting server on which I cloned the repo and run "git pull".
I know I could setup a cronjob to run this command every few minutes, but is there a better solution, which would allow an instant deployment?
Thanks!
Comments section
shaaliliton
•May 1, 2024
Support me
kip13
•May 1, 2024
You could use the webhooks and with a couple of scripts make the work, this is the simplest solution.
Another way is use Drone or gocd that kind of tools(continuous delivery/integration) use webhooks too.
moopet
•May 1, 2024
Can you push to the server instead? Pushing to a bare repo that only contains a hook to checkout the latest commit to the served directory is a standard way of working (or it used to be...)
You might not be able to do that, depending on your hosting, though.
ian Author
•May 1, 2024
Well, that would be possible, but for convenience I'd like to use my Gitea server, since it also offers a nice UI.
Client ---> Gitea ----> Server
hyperpress
•May 1, 2024
You could deploy something like Drone perhaps: itnext.io/explore-gitea-drone-ci-c...
ian Author
•May 1, 2024
Isn't there a simpler solution? I read something about git hooks