For newbie, you may already be experiencing uploading files to GitHub repo using folder where the commit message is "Add files via upload".
If you are noob like me using Git command, please see below. If you are experienced user, please share more commands.
GitHub has announced since August 2021, they would no longer allow password authentication. They adopt PAT (personal access token) approach which you can generate through profile's Setting --> Developers Settings --> Personal Access Tokens:
Screenshot :

Before you begin, make sure you have Git utility installed in your system.
So this is normally what I do,
1. Create a new subfolder
2. Copy all source files into the subfolder
3. Initialize it by typing:
CODE
git init
(This will create hidden ".git" subfolder)
4. Set the repo owner's handle or email address:
CODE
git config --global user.email "your_email_address"
git config --global user.name "your_user_name"
(I am not sure if both are required or just any one of them)
5. Create README.md if you want to do so.
6. Now add all the files to be uploaded
CODE
git add .
(Note a "." dot is added after "git add", which mean "current directory")
7. Commit changes (addition or deletion will be detected automatically) with commit message:
CODE
git commit -m "Initial commit"
(You can change "Initial commit" to any sentence)
8.
CODE
git branch -M main
(I think this is optional as the default is already "master"?)
9.
CODE
git remote add origin https://github.com/user_name/repo_name.git
(Replace user_name and repo_name with your own)
10.
CODE
git push https://personal_access_token@github.com/user_name/repo_name.git
(Replace personal_access_token with the one you have generated through GitHub settings page. Replace user_name and repo_name with your own.)
Before I forgot, I think we need to actually create a blank code repository on GitHub first, before we can "git push" using command-line. (Correct me if I am wrong)
So the above is counted as 1 commit.
To make changes to files , instead of everything, please repeat step 6, 7 and then straight to step 10. (Can skip step 8, 9)
Remember to change commit message (e.g. "Fixed bug xxxx") if you are modifying file(s) in step 7.
Please share your experience using Git command....... Thank you.
Oct 17 2021, 07:00 PM, updated 5y ago
Quote


0.0163sec
0.43
5 queries
GZIP Disabled