Home > Back-end >  Automatic update local repository
Automatic update local repository

Time:10-26

I'm having trouble creating some sort of automatic deployment function with Github So, what I have is a repository on Github, and a local folder in my Ubuntu connected to that repository on Github, and what I want to achieve is, that everytime I upload/Add a new file to the repository on Github, I can somehow run a script that updates the local folder on my Ubuntu, with those new files stored in my repository on Github.

So to sum it up; 1.Upload new files to repo in Github 2.Run script on local Ubuntu machine 3. Newly uploaded files in repo in Github gets added to local folder on Ubuntu machine.

Is there anyways to achieve this? Thanks!

CodePudding user response:

That seems to be a case for webhook, which comes with a constraint: your machine should be reachable from github.com.

If that is the case, you can setup a listener (for instance, alexandru/github-webhook-listener), which will detect JSON payload sent by GitHub on each push on your repository.
That local listener can then trigger a simple git pull in your local repository, updating its content that way.

  • Related