prerequisite--CREATE A GITHUB ACCOUNT
username-
password-
(-your computer will generate ssh key which will be added to the GIT
Step 1: Create a new repository
Log in and click on New in the top left section of your dashboard to create a new repository.
The repository can be public or private. Also, do not forget to check the Initialize this repository with a README option.
Step 2: Upload your Project
Click on Upload files button on top and upload all your project files.
In Commit Changes you can put in any message you want.
(OR)
TRANSFER FOLDER FROM YOUR LOCAL COMPUTER TO REMOTE COMPUTER (GITHUB)
-open terminal in /var/www/html in your computer
-from the project page(first page) click on git clone or download.
Clone the repository locally --using git clone command: git clone <copied item>
Make the changes to the local version – edit code
Commit the changes locally -git status
- git add <file1> <file2>
- git commit -m ‘changes’
Push the changes back up to the GitHub repository -git push origin master
Step 3: Make it live
- Go to Settings on the top right of your repo
Voila! Your website is live 🎉
Step 4: Look at your published website
Alright, time to
visit your hosted website. In your browser got to:
{{yourUserName}}.github.io/{{yourRepoName}}
eg dawnStreaks.github.io/techStreaks
References-
https://medium.com/javascript-in-plain-english/how-to-host-a-static-website-for-free-7a2a959f5e4
Configure the DNS settings for your custom domain to point to GitHub Pages. This involves adding or updating DNS records to map your domain to GitHub's servers.
- Log in to your domain registrar's website.
- Locate the DNS settings or DNS management section.
- Add the following DNS records:
- For the root domain (e.g., example.com), create an
A
record with the value185.199.108.153
,185.199.109.153
,185.199.110.153
, and185.199.111.153
. These IP addresses are GitHub's Pages servers. - If you want to use a subdomain (e.g., www.example.com), create a
CNAME
record pointing to your GitHub Pages URL. You can find your GitHub Pages URL in your repository settings under the "GitHub Pages" section.
- For the root domain (e.g., example.com), create an
Note: DNS changes might take some time to propagate, so be patient.
To redirect www
subdomain to the original domain, add a CNAME
record with your GitHub pages profile URL with a .
(dot) in the end, for example, ‘YOUR-GITHUB-USERNAME.github
set up custom domain
reference-
https://medium.com/@hossainkhan/using-custom-domain-for-github-pages-86b303d3918a
https://gist.github.com/notTag/4a60598d018124c9ac4a7b1f3e2bac9a