Storing the Hexo Site in GitHub

Now that you learned in Part 1 -> Blogging with Hexo and GitHubPages how to get your site up on [username].github.io, you need a repository that stores your original markdown and any changes you make to the files that generate your blog.

1. Create a New Repository

Create a new repository in GitHub. Don’t add a ReadMe to it; just create the empty repository. GitHub will show you a section titled

…or push an existing repository from the command line

Underneath that are two commands that you can copy to the clipboard with the clipboard icon to the right. We’ll use these commands after the next step.

2. git init (finally)

Open a terminal window at the root level of your hexo site. NOW you can do a git init, then add all your files, and do a normal commit. You’ll notice that the previous process of setting up Hexo did create a .gitignore file for you that will ignore all the generated files.

Take the copied commands from GitHub and paste those into the terminal. This will both link your local repo to GitHub and push up the changes.