A step-by-step guide to deploying web applications (using HTML, CSS, JavaScript) on GitHub Pages, categorized into three main sections for ease of understanding and implementation.
-
Create Your Web Application
- Prepare your web application with HTML, CSS, and JavaScript files. Ensure the entry point of your app is an
index.html
file.
- Prepare your web application with HTML, CSS, and JavaScript files. Ensure the entry point of your app is an
-
Organize Your Application
- Organize your files and folders in a clean structure. For a simple application, this might just involve having an
index.html
file, along with directories for scripts and styles.
- Organize your files and folders in a clean structure. For a simple application, this might just involve having an
-
Create a GitHub Repository
- If you don't have one, create a new repository on GitHub for your web application.
-
Initialize and Push Your Code
- Initialize a Git repository in your project folder:
git init git add . git commit -m "Initial commit"
- Link the local repository to GitHub:
git remote add origin https://github.com/[your-github-username]/[repo-name].git
- Push your code to the newly created GitHub repository:
git push -u origin main
- Initialize a Git repository in your project folder:
-
Deploy Your Application
- There's no need for a build step for basic HTML/CSS/JS apps. Simply push your code to GitHub.
-
Configure GitHub Pages
- Go to your GitHub repository's
Settings
>Pages
. - Under 'Source', select the
main
branch (or the branch where your code resides).
- Go to your GitHub repository's
-
Access Your Deployed Web App
- Your web application should be live at:
https://[your-github-username].github.io/[repo-name]
- Your web application should be live at:
Note
Replace [your-github-username]
and [repo-name]
with your actual GitHub username and your repository name. Ensure that your web application’s structure is suitable for static site hosting as offered by GitHub Pages.
im using node js