Upload Files to GitHub Pages: A Step-by-Step Guide

Ann Jul 09, 2026

GitHub Pages is a static site hosting service that takes HTML, CSS, and JavaScript files straight from a repository on GitHub, then renders them as a website. One common task is uploading files to GitHub Pages. Here's a step-by-step guide to help you understand the process.

GitHub - transloadit/uppy: The next open source file uploader for web browsers
GitHub - transloadit/uppy: The next open source file uploader for web browsers

Before we dive into the details, ensure you have a GitHub account and a repository where you want to host your GitHub Pages. If you're new to GitHub, you might want to familiarize yourself with the platform's basics first.

How to upload files in GitHub
How to upload files in GitHub

Understanding GitHub Pages Structure

GitHub Pages uses a specific folder structure to determine what content to display. The default branch for GitHub Pages is 'main' (or 'master' for older repositories). The content of your GitHub Pages is located in the 'docs' folder within this branch.

Upload an Existing File to GitHub
Upload an Existing File to GitHub

For example, if you want to create a new page called 'about.html', you would place it in the 'docs' folder. The URL for this page would then be 'yourusername.github.io/about.html'.

Creating a New Repository for GitHub Pages

Host Your Website FREE on GitHub in 60 Seconds!
Host Your Website FREE on GitHub in 60 Seconds!

To create a new GitHub Pages repository, follow these steps:

  • Click on the '+' icon in the top-right corner of any page on GitHub.
  • Select 'New repository'.
  • Name your repository in the format 'yourusername.github.io'.
  • Click on 'Create repository'.

Enabling GitHub Pages for an Existing Repository

an image of a web page with the word journey file uploaded on it
an image of a web page with the word journey file uploaded on it

If you already have a repository, you can enable GitHub Pages by following these steps:

  • Go to your repository's settings page.
  • Scroll down to the 'GitHub Pages' section.
  • Select 'main' (or 'master') as the source.
  • Click on 'Save'.

Uploading Files to GitHub Pages

an image of the jquery file upload demo page on ubullet
an image of the jquery file upload demo page on ubullet

Now that your GitHub Pages is set up, let's look at how to upload files to it.

You can upload files to GitHub Pages using the GitHub web interface, GitHub Desktop, or the command line. Here, we'll focus on the web interface as it's the most beginner-friendly.

Add files via upload · Hessie0802/Read2.md@67bb762
Add files via upload · Hessie0802/Read2.md@67bb762
Add files via upload · GAXI78/Jesus16789@3f25a0a
Add files via upload · GAXI78/Jesus16789@3f25a0a
GitHub - auraloglu/react-file-upload-progress: React component for upload file
GitHub - auraloglu/react-file-upload-progress: React component for upload file
How to Host a Website for Free Using GitHub Pages
How to Host a Website for Free Using GitHub Pages
How to Easily Host Files on GitHub
How to Easily Host Files on GitHub
an image of a computer screen with the text upload files on it and icons
an image of a computer screen with the text upload files on it and icons
'X0.at Filehost' that allows you to easily share files with the cURL command for free
'X0.at Filehost' that allows you to easily share files with the cURL command for free
the file upload screen is shown with an arrow pointing to it's end
the file upload screen is shown with an arrow pointing to it's end
the file upload screen is open and ready to be used for storage or data
the file upload screen is open and ready to be used for storage or data
the screenshot shows several different types of text and numbers, including one for each language
the screenshot shows several different types of text and numbers, including one for each language
Connection file
Connection file
an image of the web page for php version 5 0 30
an image of the web page for php version 5 0 30
Gitflow on GitHub: How to use Git Flow workflows with GitHub Based Repos
Gitflow on GitHub: How to use Git Flow workflows with GitHub Based Repos
an image of a website page with the text kaavloon / telepam - dot - uploader
an image of a website page with the text kaavloon / telepam - dot - uploader
GitHub - kazcfz/Copy-n-Paste: Copy-n-Paste: Clipboard Upload Simplified extension for Chromium and Firefox. Simplifies uploading copied screenshots, images, files from clipboard. No need to save as files. Similar to Opera Easy Files.
GitHub - kazcfz/Copy-n-Paste: Copy-n-Paste: Clipboard Upload Simplified extension for Chromium and Firefox. Simplifies uploading copied screenshots, images, files from clipboard. No need to save as files. Similar to Opera Easy Files.
GitHub - giauphan/Driver-api: API driver designed to facilitate seamless file upload and retrieval operations. This documentation provides details on the supported endpoints, request formats, and possible response scenarios.
GitHub - giauphan/Driver-api: API driver designed to facilitate seamless file upload and retrieval operations. This documentation provides details on the supported endpoints, request formats, and possible response scenarios.
the screen shot shows several different images in one place, and there is no image on it
the screen shot shows several different images in one place, and there is no image on it
GitHub - johndatserakis/file-upload-with-preview: 🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.
GitHub - johndatserakis/file-upload-with-preview: 🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.

Uploading Files via the GitHub Web Interface

To upload files via the GitHub web interface, follow these steps:

  1. Navigate to your repository's page on GitHub.
  2. Click on the 'Upload files' button.
  3. Drag and drop your files into the 'Drag files here' area, or click on it to select files from your computer.
  4. Click on 'Commit changes' at the bottom of the page.
  5. Add a commit message and click on 'Commit changes' again.

Uploading Files via GitHub Desktop or Command Line

If you prefer to use GitHub Desktop or the command line, the process involves creating a new file or folder in your local repository, adding it to Git, committing it, and then pushing it to GitHub. Detailed guides on these methods can be found in the GitHub documentation.

Remember, GitHub Pages supports a wide range of static site generators like Jekyll, Hugo, and Gatsby. If you're planning to use one, you'll need to follow their specific deployment instructions.

That's it! You've now learned how to upload files to GitHub Pages. Happy coding, and may your GitHub Pages shine brightly in the world wide web!