Home > Enterprise >  How to monitor remote git changes and auto pull?
How to monitor remote git changes and auto pull?

Time:12-29

I have a Windows server running a node.js program. Currently, I deploy code to it manually by pushing to github, and then log into the server, and manually run:

git pull
npm i
nodemon app.js

How can I make the server monitor remote changes on a certain git branch, auto pull, (and consequently npm install and re-run the node.js app) whenever there's a new commit on git?

CodePudding user response:

I don't think git has such a feature. But you could run a cronjob that executes your code every day at a specific time.

CodePudding user response:

CI/CD will resolve your problem

CI/CD automates your builds, testing, and deployment so you can ship code changes faster and more reliably.

If you use github: CI/CD on Github

If you use gitlab (): CI/CD on Gitlab

  • Related