SETTING UP GITHUB IN WINDOWS 10 FOR BEGINNERS
Are you a new user to Git or GitHub, this is your time to learn how to set up Git and GitHub in Win 10. Before we can start, we have to understand the difference between Git and GitHub. Git is a version control tool whereas GitHub is a platform for Git users.
For starters, download GitHub from your browser and install it on your computer. As your install git, it will prompt you to add Git bash, make sure you check the Git Bash box, and then Git and Git Bash will install on your computer.
Git Bash is the terminal/console used by Git on the windows operating system. When all this is done you surely have Git and Git Bash on your computer.
The next step is to create a GitHub account. Open your browser and go to the GitHub website, GitHub will request you to Sign up with your email. Go ahead and Sign up, Git will request you to input your username and password and then follow the procedure of opening a new account by accepting the prompts or clicking next.
Then open Git Bash and configure git global by inputting your username and the user email you used to create your GitHub account. type these commands in Git Bash; git config — global user.email you@example.com press enter and then git config — global user.name “Your Name” press enter
The next thing is creating our first repository on Git. Open your new Git account by Signing in your GitHub credentials i.e., username and password.
After signing into your Github account, navigate through your account and click on the button which is on the extreme right end of the Git navigation bar, click on your repositories, a new window will pop up on your screen with a green button that is labeled new, click the green button or you can just click on the green button labeled repositories on the left menu bar
When you click the green button, a window for creating a new repository showing the owner will pop up. Next to the owner is a place to write the repository name. Type the repository name.
As you navigate through the new repository page, you will see another box requesting you to write your description (this is optional), then go to a place where there is Public and Private, (Public is free and your data/code can be viewed by anyone while private is for paying and is not accessed by anyone apart from you and the people you have authorized to view your data/code) then you choose either Public and Private but preferrable Public. After this move down and click on the Create repository button.
The next thing is to open your Git Bash. Create a folder and then in that folder create a readme.md file by typing touch readme.md in Git Bash.
Then type git init and when you press the enter button, the git init command will initialize git with the folder hence the folder becomes a local repository therefore a default branch master is created.
Next, you open the folder in vs code. You will realize that it contains one file which is a readme.md that you created earlier. You may want to add more files such as index.html, profile.txt. when you are done creating the files in vs code, go back to the Git Bash and type the command git add with the file name i.e. (git add .) What this command does is it stages the unstaged file in vs code for committing.
If a file is not staged, it means that it's not recognized by the remote repository hence staging a file connects the file which is on your local repository to your remote repository.
The next command is git commit with a file name i.e git commit -m “readme.md, profile.txt” this command commits the staged file as a new commit snapshot.
Then create another branch main which makes you branch of the master branch that was created by git when it was initialized on the computer. The command that does this git branch -M main
You then connect the local repository to the remote by attaching a URL of the remote repository in Git Bash with command
git remote add origin https://github.com/mchrisbeckham/github.git
Now it’s time to send whatever is on the local repository to the remote repository. We do this with the help of this command; git push -u origin main
Remember as a beginner to Github, when you type the git push command, it will open a message in the browser requesting you to authorize access to your remote repository through one of the ports. So what you do is to accept the authentications