Skip to content

codebar-shanghai/workshop-github-pages

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 

Repository files navigation

Cheatsheet for the Workshop

Live Examples

Agenda

  1. Create an account on GitHub (if you haven't yet)
  2. Create a repo named username.github.io (replace username to your GitHub name), then create an index.html file with the content below.
  3. Delete and recreate the repo username.github.io, then we'll do it the real way.

Tools

  1. Git
  2. GitHub CLI
  3. Visual Studio Code

Snippet

HTML (the most simple way)

<h1>It works!</h1>

HTML (more formal way)

<!doctype html>
<html>
    <head>
        <title>test</title>
    </head>

    <body>
        <h1>It works!</h1>
    </body>
</html>

Git

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

About

Cheatsheet for the workshop

Resources

Stars

Watchers

Forks