Adding my first repository to GitHub using Git

I am a recent graduate at the beginning of my software development career. I enjoy documenting my learnings through my blogs
I am new to using Git and GitHub, but I wanted to add my first project (repository) to my GitHub account using Git commands (CLI). So if you’re a newbie like me hopefully these steps will help.
Steps I used to create a repo:
Create a new repository


a. Name your repository

b. Add a README.md file, here you can give a more in-depth description of your work.

c. Add a .gitignore file, a drop-down list of tools is provided during the initial setup. This will not allow specified files to be uploaded to the repository.

Using the Git CLI,
clonethe repository to the computer to a selected folder, for example,C:\Users\<userprofile>git clone <https://github.com/><userprofile>/<reponame>.gitthis will clone the repository into the folder you have chosen and create a folder with the repository name
- this will create a folder with all the repository files you have clones
For my example I had a previous project I wanted to add so I copied and pasted the files into the repository folder
I then did a
statusrequest, this showed me that my branch was up to date and that there were files not tracked within the foldercd <reponame> git status # Output On branch main Your branch is up to date with 'origin/main'. Untracked files: (use "git add <file>..." to include in what will be committed) example.sln src/ nothing added to commit but untracked files present (use "git add" to track)These files now need to be added to the repository in order to be committed.
- these files can be added individually by name or by using
add .
- these files can be added individually by name or by using
git add .
git add src
Now I can commit these changes by using the commit command, with this I need to add a
commitcomment using-m, see the example below:git commit -m "Added code files"This has committed the files to the repository, they must now be pushed to the online repository (Github)
git pushWhen using the
pushcommand you may be asked to sign into your GitHub profile.this can be done through the Git login window
or you can log in using the CLI
GitHub login
you will be asked for a username first and then a password
I ran into issues using my GitHub password, it did not want to accept this. Instead, it wants you to use a token password (this worked better in the CLI)
You can find access to tokens under your profile settings

you will then find a list on the left-hand side of your screen, this will give you a <> Developer settings option

I then selected Personal access tokens and it gave me 2 options, I used Tokens (classic) and followed the steps to setting up the token.
💡Fine-grained tokens are more secure and can choose to allow access to selected repos. I chose Tokens (classic) because I am new to tokens and it seemed like a more straightforward token option for a beginner as it allows access to all repos. But, I can understand why someone would want to use Fine-grained tokens to secure their work.




