Summarize of common issues we faced in my-first-site practice:
1. Authentication issues:
In the terminal of VS code, execute the following codes to set up your GitHub account.
git config --global user.name <github userID>
git config --global user.name mygithubusername
git config --global user.email <github email>
git config --global user.email firstname.lastname@example.org
When you proceed to execute
git push -u origin main
, you will be promoted to an authentication window, you can simply choose to Sign in with Browser to authorize VS code to connect to your GitHub account or use username and password.
If you still have issues with authentication, you can choose to use SSH, I wrote a simple guide - how to use SSH to log into GitHub guide from VS code.
2. Execute code at the wrong path:
You have to execute code like
git init in the path of the my-first-site folder.
For beginners, to navigate in the command line interface, use
cd foldername to change the working directory to "foldername", use
cd .. to change the working directory to the parent folder of the current folder, use
ls to show all folders and files of the current folder.
3. How to redo the practice:
If you are stuck somewhere and would like to redo the practice, you will need to delete the hidden .git folder inside my-first-site folder, then start from executing
Another way is to create a new folder and start from creating index.html, scripts.js and styles.css.
4. Why the website didn't show up
GitHub pages need about 2 - 5 minutes to show up after the initial setting.
The same as the initial setting, if you made some changes to your code, and push the code to the GitHub repo which you have already set up GitHub pages, you also need to wait about 2 - 5 minutes to see the changes on the website.