In this article we are going to cover How to Create Account in GitHub and How to use GitHub, How to Create New Repository in GitHub/create free private repository in GitHub.
Install Git, Generate new ssh keygen in Git and add ssh-key in GitHub profile, Clone GitHub Repository using Git Bash in Windows,
Clone GitHub Repository using Git Bash in Windows,Commit code in Git Repo and Push code from Local to GitHub and Merge code from dev branch to main branch.
Below are steps for Basic GitHub Tutorial for Beginners
Table of Contents
Step #1: How to Create Account in GitHub
Go to GitHub.com and Click on We can see a Sign up option on right top corner of desktop
Enter all your basic information like Username, Email address, Password for your account.
Then get verify your account by solving that puzzle or entering captcha value
Click on Create Account.
After creating account in GitHub this will be the first page which will be displayed.
we have covered create account in GitHub.
Step #2: How to Create New Repository in GitHub
In the top right corner of GitHub’s home page we can observe a add (+) button, we just have click on that and select “New Repository” option.
Give a name for your repository for Ex. “intern2021”.Write a short description about your repository, Let the access be Private or Public.
Below you can see “Intialize this repository with:”, Select the first option Add a README file, Now click on Create repository
Our repository is created, you use below instructions on GitHub to create New repo on command line.
we have covered create account in GitHub and Created new repo in GitHub.
Step #3: Install Git
Download Git as per your OS from Git Official Site.
Follow below article to install git on Windows 10
Step #4: Generate new ssh keygen in Git and add ssh-key in GitHub profile
Click on your GitHub Profile and Click on settings.
Click on SSH and GPG Keys.
Click on second link i.e Generating Generating a new SSH key and adding it to the ssh-agent.
Go to Guide generating SSH keys and click on Generating a new SSH key
Open Git Bash from your system
Execute command with your email address.
ssh-keygen -t ed25519 -C "[email protected]"
press enter two times, Keep the default path if you want
SSH key is generated successfully in Git Bash
To ensure ssh-agent is running or not, Run below command.
eval ‘ssh-agent -s’
Use below instructions to add your SSH private key to the ssh-agent
ssh-add C:/Users/Dell/.ssh/gitlab (your path)
Next follow below steps to Add a new SSH key to your GitHub account for windows
Copy the SSH public key to your clipboard
clip < ~/.ssh/id_ed25519.pub
In the upper-right corner GitHub profile page, click your profile photo, then click Settings.
Enter the name for your key
After giving title and paste the copied key, click on Add SSH key
After creating key successfully, like below window will be displayed.
Step #5: Clone GitHub Repository using Git Bash in Windows
To Clone GitHub repository to local, Open a directory where you want to clone , Open Git Bash Here option
Execute below command to clone GitHub repository to local using ssh
It will ask you that are we sure to continue, so type sure and enter
Our repository has be cloned successfully to local
Step #6: Creating Branch using Git Command
Now we have to create a new branch for our repository by using the below command
git checkout -b <branch name>
Check the current branch using this command
Create a index.html file in new branch
add some code into it.
Execute ls command to check current files in repository
Add our code to dev branch using this command
git add .
Step #7: Commit code in Git Repo and Push code from Local to GitHub
Now we have to commit the code using below git command
git commit -m “index.html”
This index.html file is that file which we created in our local and now we will commit it
Now we will push the code to GitHub using this command
git push origin dev
Code has been successfully pushed to GitHub.
Step #8: Merge code from dev branch to main branch
First we will have to checkout main branch using below command
git checkout main
Now we will merge the code from dev branch to main branch using below command.
git merge dev
After merging the code from dev branch to main branch push it on GitHub again using below command
As we can see the code is merged successfully and even changed from dev branch to main branch.
It is also reflected on GitHub in main branch.
We have covered How to Create Account in GitHub, How to Create New Repository in GitHub, Install Git, Generate new ssh keygen in Git and add ssh-key in GitHub profile, Clone GitHub Repository using Git Bash in Windows, Clone GitHub Repository using Git Bash in Windows,Commit code in Git Repo and Push code from Local to GitHub and Merge code from dev branch to main branch.