Git and GitHub Hands-on Practical
Day 1: - Task
Today we are doing configuration setup of Git and GitHub in our System, so
that we can easily push our code on repository for future reference.
Here step by step process are given below:
1. First go to github.com and signup if you have an account then login
https://github.com/
2. Download git and install in your system
https://git-scm.com/downloads
3. Check your git is properly installed or not by using
git –version
4. Check your user config in Git Bash by using command
Git config –list
5. If there are no user then add by using command
git config –global user.name “username”
git config –global user.email “useremail”
6. If you want to remove any user from your git then use command
git config –unset –global user.name “”
git config –unset –global user.email “”
7. Now go to GitHub, click on your profile, choose your repository menu
then click on New to create a repository
8. Once repository create then copy given URL and past it in your code
editor like VS Code or in git bash by using following command
git clone <URL>
press enter
9. Open this repository in VS Code or any other code editor software
In VS Code install an extension to connect your GitHub Repository
Click on Account icon which are showing at left bottom corner and
sign in with your GitHub account
After completion of these task create file like index.html and write
your code. Save it
10. Open terminal in vs code and use command to stage your code
git add . for staging all code
git add <file-name> for staging particular file
11. After staging, save your code in local repo by using following command
git commit -m “meaningful message”
12. After commit, save it on your central repo (GitHub) by using
git push origin <branch-name>
here, origin is remote access name
if there is any right access permission error are showing then use
following command for remote access
git remote add origin <URL of repository>
13. Now check repository, your find your code successfully store on GitHub
14. After complete above step, use these command to check status of your
workspace , see commit, difference etc. using following command
git status to check workspace status
git log –oneline to show all commit in a single line
git log to show commit list
git show <commit-id> to show what is commit in repo
Second Method to store your code in central repository
15. First create a folder in your system like ( Demo )
Open it in VS Code
Open terminal and run the following command
git init to initialize your folder in git repository
do step 9 for extension and account, if already done ignore it
16. After completion of Step 14
Stage your code and commit it in local repository by using
Step 10 and 11
17. Before push your code on GitHub, connect your remote access by using
following command
git remote add origin <URL of repository>
18. And last push your code on GitHub