GitHub – setup auto deployment with remote server

Currently, my production website is hosted on Azure. I use git and push all my commits to GitHub. With the magic of git hooks Azure has the ability to pull from GitHub when someone pushes a certain branch to GitHub.

How can I replicate this with my own staging server hosted on-premise? In other words, how can I set a repo on GitHub, and when I push to it, through git hooks send a signal, request or what-have-you to perform an automatic pull on my on-premise server?

  • How can I only publish a subfolder to my Azure Website?
  • Deploying to Azure WebSites using git
  • Azure Web App of nodejs application loads blank screen after deployment
  • “Cannot find WebSpace” error when publishing with Microsoft Azure CLI
  • Azure build stopped working when using xproj based ASP.NET Core project
  • Azure git deployment failure
  • I know Git is not a deployment software, but if I have to write a mechanism on my on-prmise server to make this happen I would like to know where to start. If it’s helpful, we use Microsoft technology, so we are running our staging server on Windows Server, while our production is on Azure.

    I understand that I’ll need to use callback url on my server to then perform whatever is needed.I would like to know what methods people use to accomplish this. e.g.: on my call back url, how would I call a script to run a pull/fetch/clone bash command. or other method.

    If you need more information, feel free to ask.

  • Is it possible to diff PowerPoint version-controlled with git?
  • Slow Git operations
  • How do I Uncommit changes using git
  • Cant create TFS Work Items, Denied Access to registry key that doesn't exist
  • Update website with a single command (git push) instead of FTP drag and dropping
  • Commits since a certain commit number
  • One Solution collect form web for “GitHub – setup auto deployment with remote server”

    Expanding upon my comment,

    1. You would need to define/create a callback url on your end, which
      will need to be publicly accessible.

    2. github would make a hit to this url via a git hook whenever a
      push is made to the branch in question.

    3. You can add authentication for the hit in the hook, if needed.

    4. This call will inform your server that a push has been made to the
      certain branch on github.

    5. Now your server should start a deployment task which does the

    Regarding this deployment task, there are many ways to do this, and the finer details will vary depending on how you do it.

    One way would be to introduce a Continuous Integration tool like Jenkins in your stack, which you could also use for regular and test builds in different environments.

    Another way could be to execute a simple bash script which does cd $REPO_DIR && git pull origin branchname && service apache2 etc restart.

    Git Baby is a git and github fan, let's start git clone.