Using GitHub to Manage or Host an MIT Website
|There are two possible solutions:|
- 1 Using GitHub to Manage or Host an MIT Website
- 1.2.1 Initial Set Up
- 126.96.36.199 Github Repository
- 188.8.131.52 AFS
- 184.108.40.206.1 Request or Use Existing Locker
- 220.127.116.11.2 Clone the Repository
- 18.104.22.168.3 Make Directory World-Viewable
- 1.2.2 Maintaining the Site
Example URLs and Usernames
In this article, many example URLs and usernames are needed to explain functionality. For the purposes of clarity and internal consistency, the following are used:
|Alpha||Name of Project/Website/Locker||Alpha Group, Alpha Project, alpha.mit.edu, web.mit.edu/alpha, /mit/alpha|
|Bravo||Username on Public GitHub||github.com/bravo, bravo.github.io|
|Charlie||MIT Username and Associated AFS Homedir Lockeremail@example.com, /mit/charlie|
|Delta||A Subdirectory||bravo.github.io/delta, web.mit.edu/charlie/delta|
|Having DNS records created for your site requires a Cost Object. While there is no charge for this process, it is intended for official DLC purposes, and the Cost Object helps assign long-term ownership for the record.|
Create a GitHub Pages Repo
Make a GitHub Pages repository, see the instructions here.
Point an MIT URL to the New Site
Once the site is ready, IS&T can make DNS records to point to it. From Connecting an MIT URL to an Outsourced Website:
You should establish a bravo.github.io hostname for the entire site; we will not be able to work with a requested path that is bravo.github.io/delta.
Note also that we do not provide Github Pages functionality on our internal github (github.mit.edu) - you must use the externally hosted github if you wish to host web content there.
We will provide a single CNAME record:
Initial Set Up
Create a repo on github.mit.edu to manage your site files. If you are a staff, faculty member or student and haven't already signed up, just go to github.mit.edu to get started. See this page for more details.
Request or Use Existing Locker
Pick a location to store your site files in AFS, either:
- Request an organizational locker
- Use a subdirectory of your own homedir or other existing locker, e.g. /mit/charlie/delta. Note that this means the URL for your site will be: web.mit.edu/charlie/delta/
Clone the Repository
Clone your repo into your EMPTY locker or subdirectory via HTTPS:
|The trailing period (".") is critical. Without it, git will make a new directory to store these files.|
Make Directory World-Viewable
Set the permissions in AFS
If you have an organizational locker, the path would look something like: /mit/alpha, or explicitly /afs/athena.mit.edu/org/a/alpha
Wait 15 minutes, and check your site, e.g.: web.mit.edu/alpha
|To set permissions for this directory and all subdirectories, use fsr instead of fs. You will need to have access to /mit/consult do so, either by running add consult or by manually appending it to your PATH variable.|
For a more detailed look at how this works, see: How do permissions work in AFS?
For details on a more sophisticated permissions configuration, e.g. restricting access by certificate, see: Web Publishing - Access privileges on web.mit.edu
Maintaining the Site
Ideally this repo would be cloned on a personal machine(s) to make changes, which would then be tested, commited and then pushed back into github.mit.edu.
Once they are ready for public consumption, they can be pulled down into AFS.
- Navigate to the directory in AFS
- Pull the latest data from github.mit.edu, in this case from the master branch:
- Clear your cache and refresh your browser, and you should now see the latest copy of the page(s).