GitHub/Website Hosting
Appearance
< GitHub
GitHub supports free website hosting for static sites called GitHub Pages. This provides an opportunity to combine source code control and website hosting for learning HTML, CSS, and JavaScript.
Prerequisites
[edit | edit source]- Complete the GitHub/Get Started tutorial to join GitHub and learn how to create a repository and add files.
Create a Repository
[edit | edit source]- Review GitHub Pages: Websites for you and your projects
- Visit GitHub and sign into your account.
- Select Repositories / New.
- Enter
username.github.io
for the repository name, whereusername
is your GitHub username name.
Note: usernames and repository names cannot contain special characters such as underscore (_) when using GitHub Pages. If necessary, rename your account under GitHub settings before creating your repository. - Select the option to make it a public repository.
Note: only public repositories can have a website when using GitHub Free. Students can request a GitHub Student Developer Pack for free GitHub Pro while they are students. - Select the option to Initialize this repository with a README.
- Create the repository.
Edit the README
[edit | edit source]- Review GitHub: Editing Files in Your Repository.
- Select the link to your README.md file to open the file.
- Select the
Edit this file
icon (pencil) to edit the file. - The README may contain anything you like. Because it is a private repository, only you and users you invite will be able to see this repository.
- Commit the change to modify the README file.
- Observe the new front page for your repository.
- If desired, edit the README and commit additional changes now that you are able to see how the README will appear.
Create a File
[edit | edit source]GitHub repositories are typically managed using the git command line or a git utility. But it is also possible to edit content directly using the GitHub website.
- In your GitHub repository select
Create new file
. - Enter
index.html
for the filename. - Enter anything you wish for the file content.
- Commit the change.
Publish Pages
[edit | edit source]- View your GitHub repository / Settings / Pages.
- Select the main branch and the folder containing your index.html file.
- Save the changes to publish your site.
View the Page
[edit | edit source]- In a web browser, navigate to
https://username.github.io
to view your page. Be sure to replaceusername
with your GitHub username name. - If you are not able to view the file, the README.md file will need to be changed. Select a theme for this README.md file. Click on your Repository Settings, scroll down the page to GitHub Pages, Change Theme, Select Theme.
Enhance Your Website
[edit | edit source]- Update your GitHub repository by editing index.html and adding web pages, CSS files, images, JavaScript, or other content as desired.