Pushing and Hosting Your Website

Challenge: Push Your Files with Clarity

Now that you've moved your files to the repository, it's time to push them to GitHub. But wait—we're not just going to dump everything in one go! This challenge is all about organizing your commits to make them clearer.

Imagine you're working on a project with a team. It's important for everyone to understand exactly what changes you've made. By splitting your commits into logical groups, like HTML files and CSS files, your work becomes much easier to follow.

Your Mission

Use the terminal commands you've learned to:

  1. Create a commit that includes only your HTML files. (Hint: Use the wildcard operator to target files ending in .html.)
  2. Create a second commit that includes only your CSS files.
  3. Once your commits are ready, push everything to GitHub!

Commands to Help You

Here's the first step and the final push command to help you get started:

git remote add origin <repo_url>

Adds the remote repository link to your local repository.

git push -u origin main

Pushes all your committed changes to the main branch on GitHub.

Hint: By using wildcard operators, we can target any type of file. Including folders. Consider **/*.js: this would target any js files, even if they're inside another folder.

Part 3: Hosting with GitHub Pages

Once your files are pushed to GitHub, make your website live by enabling GitHub Pages:

  1. Go to your repository on GitHub and click Settings.
  2. Scroll down to the Pages section in the sidebar.
  3. Under Branch, select main and click Save.
  4. After a few moments, GitHub will provide you with a link to your live website. Test the link to ensure it's working!

Once your website is live, take a moment to admire your work—you've officially hosted your first website using GitHub Pages!