Hello and welcome to this session on git and
GitHub This is the second session and today we will start with installing git and adding
our files and folder to track the changes So today we are going to learn how do we download
and install git we will also create a free account on GitHub We will add a folder and
a file to get to track the changes and then we will add our repository to get up So let
us begin and let us see Step number one is we have to check if git is already installed
So because I am on mac I will go to my terminal and in case you are on Windows I will have
a separate session on getting started with Git and GitHub on Windows on the this session
I will install and start with git on a Mac So what you have to do is we have to go to
your terminal and say git --version Okay now in my case because git is already installed
I am getting this git version in case it is not installed You will get something like
command not found So let us assume it is not installed on your system and you are getting
command not found So what you have to do is so let me just write down you have to go to
terminal and you have to say git--version, please note. There is no space here It is double - I have
to give a space because it is not taking- it merges the two dashes So it is git --version
now step number 2 is download and install git so what we're going to do is go to Google
and say get the very first site that you will get is gitscm.com Go here and here you can
find download get so you can download it from here And if the download does not start you
can click here to download it manually Okay So in my case, it is already downloaded So
I will just go to my folder and see where is my get installed? so in my downloads I
can see Yes, this is the file that got downloaded You will double click here and you will do
the installation So as you do installation of any other software, it will guide you you
can just click continue and you can install it right I am canceling it right now because
I already have it installed Once you have installed it you should go to your terminal
again. You can create a fresh session of the terminal
and again, you will say git --version and this time you should be getting the version
of git that is installed on your system As of now My version is 2.10 Okay, so this should
install git on your system Okay? The third step should be I'll just copy this
site as well. So that you can see from here Okay now step
number three will be Sign up and create a free account on GitHub we can do this later
as well But because we want to add our username and our email to git we will first create
an account on GitHub So again, you can go to GitHub this is the site for GitHub github.com. Okay, and let me sign out You can go to sign
up And here you can create your account you will give your username email password and
you can create a free account Okay So once you have created the account you can sign
in to your account. Okay, so this is my account, right? So you just have to create an account on GitHub
So once you have downloaded installed yet and you have already created an account on
GitHub now we can start with git on our system Right? So let's say step number 4 will be
add your GitHub email And username to git so what is this you just have to do this. Go to a terminal And you have to run these
two commands git config Global user dot email and whatever email you used to sign up on
GitHub and then get config Global user dot name Whatever user name you used right? So you will just go to your Terminal and you
will give these two commands Okay so in my case I will say autamation.qa.sel@gmail.com
and the username that I have used on GitHub is This one So just you have to run these
two commands The reason we want to add our email and our username is because whenever
we commit any changes from this system, this will already know that this is the user who
is committing these changes and in your GitHub repository all the changes and commits will
be shown by this particular name Whatever username you are using right So that is why
we add our email and username Okay now when we have added it, let us Start adding our
files and folders So step number five will be at file or folders to get And this is your
doing it for tracking the changes So now the actual work of git starts, right So let us
do one thing Let me go to Let us create a folder and file that you want to check So
I'm going to tools On my desktop I have a git folder and let me hide the sidebar and
here I will create a new folder And let me name it my folder Okay, and what we have to
do is I want to check all the changes and I want to add all the contents of this particular
folder to get what I will do is I will go to my terminal and first I will go to the
location of this folder So I will go to this load this folder is located at desktop tools
git My folder, okay So let me go inside it now I have gone inside this folder on my terminal
So the very first thing that I have to do is I will also write it down here So step
six is our now our actual commands of data starting So I will give it as the name as
command and the very first thing we have to do is on the terminal go to the location of
the folder or it can be a project in case you want to add the source code You will go
to the location of the project and then you will say get in it, right So as soon as I
will say git in it, you can see initialized empty git repository in this particular location
So what it has done is it has added a hidden folder by the name.git and we cannot see it
because we are not able to see the hidden files and folders as of now So in case you
want to see that folder in Mac, you have to run this command defaults, right and the rest
Of the thing Yes, and when you want to hide the folders, then you will say no here as
of now I want to say yes and run this then I will press option and command key on my
keyboard and right click on finder and click relaunch Okay So now you can see this hidden
folder Get on this on this particular folder that we have added right now the second command
is Git status Okay Now, this is a very handy
command and You can let me type git status now and you can say nothing to commit because
we have not added anything right Let us add some file here So let me say touch Test1.txt
So you can see I have added a file here Okay Now if I say get status It is showing me that
there are some untracked files Okay, so now because git is tracking this folder, whatever
changes or additions you make in this folder will be seen by git and because we have not
added this file for checking if this it is showing us keep this file is added but it
is not being tracked and to track we have to use git head Okay So the next command that
we have to do is git add so what I will do is I will say git add and the file name Now
again, let us go to git status and see what is the status now and now you can see this
is in green, right? So this is now being tracked but still it
is not committed So the next thing that we have to do is commit it, right? So the next thing we will do is git commit
Okay, and we also give a message while committing their this message will be shown in the repository
when we commit it So we will say -M and whatever message we want to give Okay, so here I will
say get commit -m and I can say add test1.txt Now you can see git status And now everything
is clean Nothing to commit Okay now let us do one thing Let us make some changes in this
file and let me say this is change one Okay I made some changes and let us also create
a new file So I will say touch index.HTML So you see I have made some changes in this
file, which is already being tracked by git and I have also added a already being tracked
by git and I have all also added a see what is the status now Now you can see it is showing
us that there are two changes one is the modification in the file, which is already being tracked
and then there is addition of a new file which is Not being tracked Okay Now we have to add
it right so we can say get at now suppose you have multiple files or changes that you
have not added What you can do is in git add you can also use wildcard characters For example,
you can say star.txt so that all the files with the extension txt will get edit you can
do star.star everything will get added or you can do git add which will add everything
within that particular project or folder So I'm doing git add and now let me do git status
and you can see both these files are ready to be committed. Okay, so now I can say git commit -m And I've
added index.HTML And I have modified Test1.txt Okay, let us do get status and everything
is clean Okay, so till now we have learnt How can we add our project or a folder or
a file to git for tracking? How can we do the changes at the changes and
then commit it right now We want to create a remote repository and add all our project
and files and folders to the remote repository Okay So now we will create a remote repository
on GitHub So sign in to your GitHub account and here You can go to new Repository Okay,
click here You can give some name Let me give repo1 and let it be public and create a repository
And here you have got their location of this repository, you can copy it from here and
then here you will say on your terminal you will say git remote add origin and paste the
location of the repository Okay? And click enter So now this is being added
but still if you go to your repository and see you will not find anything here because
we have still not pushed the changes so we have to push it right So let me also add this
here The next command is git remote add origin and the location of remote repository Okay,
but now we will push the changes to the remote repository so we will say git push - u origin
Master Master is the main branch and by default This is the this is the will go to the master
Branch So I will say this and press enter and now you can see something is getting edit
Right all this thing's are getting edge to the remote repository and it is hundred percent
complete So let me also write here git push -u origin Master okay Now, if you go to your
repository and refresh it, you should see all the changes and all the addition So we
edit index.HTML test1.txt Everything has come here and the last additions or commit will
be shown up and see now it is showing this username, right? This is showing because in the initial steps,
we added our email and GitHub username to our gate so that The reason we added it, right
So now whatever changes you do will be pushed here and tracked here. Okay So this is how we can add our repository
to the remote Okay, then there are some other commands like you can say git log this will
show you the log of whatever you have done So I have added index.HTML and test1.txt This
will show that you can do git --Help and this will show you all the options you have for
GitHub Okay, so For benching check out and for collaborate you have put little push and
fresh So we will see all these options our next session Okay So I hope we were able to
create a git repository We added a git key to our system and then we also added a project
or folder or files to checking and pushed it to GitHub Okay So hope you like it keep
learning in our next session We will learn more commands of Get Thank you for watching