How Do I Get git to Push master to a Remote Host?

I am developing an Ansible deployment solution for my department.  I write Ansible playbooks on my workstation, then push them to git.   I then log into the Ansible Master host and run git pull to pull down the changes for testing.

Is there a way to have git automatically push the changes to the remote host whenver I push a change to the master branch?  It looks like hooks are the way to go, but I’m having trouble figuring out how exactly they work, or how to get started.

Hi @andrewbcoyle ,

Do you mean after you commit some changes to master branch on the local repository hosted on your workstation, you want it can automatically push the changes to the remote repository?
I tried and checked, this feature does not support on GitHub, and I did not find any other method to meet this request.

1 Like

Almost. What I want is after I push to master on the remote (github) I want GitHub to automatically push the changes down to a different host that I control.

On the host controlled by you, whether it supports to install self-hosted runners?

If yes, you can install a self-hosted runner on your host, then setup a workflow with on.push event on the GitHub repository. And also set to use the self-hosted runner to run the workflow.

In the workflow, you can setup some jobs/steps to execute the git commands to download/clone the repository from GitHub to the host, or sync local repository from remote repository (GitHub).

More details about self-hosted runners, you can reference here: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/hosting-your-own-runners