- Create an account on GitHub (if you haven't yet)
- Create a repo named
username.github.io(replaceusernameto your GitHub name), then create anindex.htmlfile with the content below. - Delete and recreate the repo
username.github.io, then we'll do it the real way.
<h1>It works!</h1><!doctype html>
<html>
<head>
<title>test</title>
</head>
<body>
<h1>It works!</h1>
</body>
</html>A more detailed cheatsheet made by GitHub.
# 0. Run the following two commands only if you haven't set yet
# Replace with your user name and email
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com
# 1. Navigate to project folder
cd ~/Projects/username.github.io
# 2. Initialize Git
git init
# 3. Add HTML file(s)
git add index.html
# 4. Commit changes
git commit -m "First commit"
# 5. Rename default branch to main (optional but recommended)
git branch -M main
# 6. Connect to GitHub repo (replace `username`), this is also only needed for the first time
git remote add origin https://github.com/username/username.github.io.git
# 7. Push to GitHub
git push -u origin main