- Create a GitHub Account:
- Go to GitHub and sign up for an account.
- Download GitHub Desktop:
- Download and install GitHub Desktop for your operating system (Windows or Mac).
- Open the app and log in using your new GitHub account.
- Configure GitHub (for Mac Users):
- After logging in, click “Advanced” to verify your name and email settings.
- Optionally, click “Install Command Line Tools” to enable command-line access for future use.
- Create a New Repository:
- In GitHub Desktop, create a new repository with the name
your-username.github.io
(replace “your-username” with your GitHub username). - Take note of the folder where the repository is saved. Ensure the “Push to GitHub?” option is checked.
- In GitHub Desktop, create a new repository with the name
- Add Website Files:
- Move all files for your website into the new GitHub repository folder created in the previous step.
- Important: Your main HTML file must be named
index.html
and should be in the top-level directory.
- Commit Changes:
- In GitHub Desktop, check that all website files are listed in the left column.
- Enter a commit message like “Initial commit,” then click “Commit to main.”
- Publish the Repository:
- Click “Publish repository” in the top-right corner of GitHub Desktop.
- View Your Website:
- After a few minutes, go to
your-username.github.io
to see your live website!
- After a few minutes, go to
Setting Up a Custom Domain (Optional)
- Configure Domain Settings:
- Log in to your domain registrar and find the settings to update host records. Look up “(your domain registrar) change host records” if you’re unsure.
- Update A Record:
- Change your domain’s A Record to
204.232.175.78
(GitHub’s IP address) to direct your custom domain to GitHub’s servers.
- Change your domain’s A Record to
- Add a CNAME File:
- In your local repository folder, create a file named
CNAME
. - Inside the file, type your custom domain (e.g.,
www.yourdomain.com
), and save it.
- In your local repository folder, create a file named
- Commit and Sync Changes:
- In GitHub Desktop, you should see the new
CNAME
file. Enter a commit message like “Adding CNAME file” and click “Commit to main.” - Click “Push origin” to sync the changes.
- In GitHub Desktop, you should see the new
- Wait for the Domain to Resolve:
- It can take up to 48 hours for the domain to point to your GitHub site, though it usually resolves faster. Check back periodically to confirm.