Jeff
Jeff

Reputation: 4003

git: getting my website to fetch content from Github

I'm somewhat new to git and github, but I'm wondering if the following is possible.

I have several .xml files that I'm version controling in a separate repo and what I would really like is for the website to be able to call up ("pull" into a designated directory on the server) the most recent version (and eventually older versions) of the file from the github repo.

Is the GitHub API pull something that might allow me to do this?

Would I need Git installed on my hosting server? Are most hosting service able to provide this?

Am I way off base here?

Upvotes: 0

Views: 341

Answers (1)

Amber
Amber

Reputation: 526743

You don't need the API to get the latest version of a file - you can just use the GitHub raw URL for the file.

https://github.com/<username>/<projectname>/raw/master/<filepath>

For instance, here's the README.md file from one of my personal projects:

https://github.com/ayust/pluss/raw/master/README.md

You can substitute a commit SHA, tag name, or different branch name for master to get a different version.

Upvotes: 1

Related Questions