简体   繁体   中英

Pull from git to website on commit

Before I state my question, I'd like to point out that I may be going about my goal entirely wrong, so please let me know if I am.

What I'm trying to do is to have my personal website pull in code from a github repo that I'm going to set up for an HTML5/JavaScript game. Whenever I commit to the repo, I'd like for the site to pull in the updated code and serve that up to users. I saw in another similar question how to link directly to the source files on GitHub, but I feel like this would be an unfair abuse of GitHub's hosting capabilities.

So, would this be some kind of chron job or script that I have running on the site? Or does GitHub perhaps provide some sort of API that could trigger a callback to git-pull on a commit?

Here is a guide that may work. You're basically setting up a git repo on the server and pushing to it. The better way is in the article listed. The hacky way that I've done is to simply clone the repo on the machine and pull changes from a production branch. Terrible idea.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM