PUBLISHING A WEBSITE WITH GITHUB PAGES & GITHUB DESKTOP
COMP 126: Practical Web Design & Development for Everyone
Already familiar with git/bash/the terminal/the command line?
Do your own thing. Or use these instructions or these instructions and/or watch this video or this one or find another good video or tutorial.
Otherwise, follow along.
(Note: there are lots of ways to do all this. This is just one option that might be easier for beginners to git/GitHub to pick up.)
1. Set up a GitHub account and log in
- Create a GitHub account at https://github.com/ (if you don't have one).
- Verify your email address.
- Return to https://github.com/ and log in.
2. Download, install, and log in to GitHub Desktop
- https://desktop.github.com/: download and install.
- Move GitHub Desktop to your Applications (Mac) or Programs (Windows) folder.
- Launch GitHub Desktop.
- GitHub Desktop app -> Preferences -> Accounts -> log in with your GitHub account information.
3. create a "repository" (a space that will house your website files on the github.com cloud)
- On GitHub Desktop, click File > New Repository.
- Fill in the details:
-
Repository name: For your first website project, use the name
<yourgithubusername>.github.io
. After this first one, any name is fine, but avoid spaces and numbers. - Description: Add a brief description (optional).
- Local Path: Choose a folder on your computer where the repository will live.
- Check the box for Initialize repository with a README.
-
Repository name: For your first website project, use the name
- Click Create Repository.
4. Add your website files to the repository
- Open the repository folder on your computer (accessible from GitHub Desktop by clicking Repository > Show in Explorer/Finder).
- Add your website files (e.g.,
index.html
,style.css
, etc.) to the folder. Make sure index.html is at the top level, not inside a subfolder! Depending on your project, you may have to revise some of your paths. - Return to GitHub Desktop:
- GitHub Desktop will show the newly added files under Changes.
- Stage and commit the changes:
- Write a descriptive commit message like “First commit of website files".
- Click Commit to Main.
5. publish the repository to github
- In GitHub Desktop, click Publish repository (top-right corner).
- Ensure the repository is public (required for GitHub Pages).
- Click Publish Repository.
6. enable github pages on github.com
- Go find the repository you've just created on github.com (upper right-hand corner icon > Your repositories).
- Click Settings > Pages (in the left sidebar).
- Under Source, select a branch (usually
main
) and click Save. - Wait. It'll take a minute. Refresh a few times. Eventually...
- GitHub will provide a URL for your website (e.g.,
https://<username>.github.io/
).
7. make updates to your website
- Make your edits on the copy of the files stored locally on your computer.
- Open GitHub Desktop:
- The updated files will appear under Changes.
- Stage and commit the changes:
- Write a clear commit message (e.g., “Update homepage text”).
- Click Commit to Main.
- Push changes to GitHub:
- Click Push origin in GitHub Desktop.
-
GitHub Pages will automatically rebuild the site after changes are pushed. Again, this might take a minute. Just keep refreshing.
126-Publishing Your Site with GitHub Pages
By tkjn
126-Publishing Your Site with GitHub Pages
- 2,928