Lesson 24
Introduction to Git and GitHub [raw] - Software School (2024-04-29)
Source Code: https://github.com/nbktechworld/introduction-to-git
Video Transcript
All right, so today we'll talk about Git.
Git is a program or a tool that we can use for version control.
Version control is a way that we can keep track of the changes in the source code.
So when we didn't have version control, how do you keep track of, you know,
people are changing the code of the program all the time, adding new features and so on,
so they release new versions, right?
So we have version one, version two, and so on.
How to keep track of all those code changes.
You know, it could be the very naive way.
Okay, we're going to copy and paste the code.
You know, have version one, here's the copy.
And then when we're ready for version two, you copy and paste another one.
And then version three, copy and paste.
But that slowly becomes a huge mess.
You know, you cannot keep track of things.
You cannot look back in the history.
Who did what? What changed what?
What happened here in this line of code?
So all of these problems are solved with what's called version control.
Now, the most popular today is Git.
You know, back a couple decades, there used to be CVS, SVN, that kind of stuff.
There's even other stuff like Mercurial.
I think Facebook likes using that.
Maybe Google uses their own.
I don't know.
But Git is the most popular.
And we're going to talk about that.
It even got leveraged into existing services we have today,
like github.com, GitLab, Atlassians, Bitbucket, Microsoft Azure DevOps, and so on.
Okay, so without further ado,
those are the requirements.
Like I said, you must download Git from this.
You either probably have it in your machine if you go to the terminal
and type git-version.
Let me show you.
I'll share my terminal.
You can open any term you want.
I'll use command prompt because I'm on Windows right now.
So I'm going to do git-version.
And I can see if it tells me what version I have, that means it's installed.
If you don't see this or it's erroring out,
you need to install Git from that website that you showed you.
Okay, so let's start off with like a project.
I'm going to make a directory mkdir.
This is the command creator directory.
And I'll call that introduction dash to dash git.
You can call anything you want.
Now I can cd or change the directory to what I just created by saying cd space
introduction to git.
All right.
Now I'm going to open this in my Visual Studio Code
by saying code space dot dot meaning current directory.
So I can have that directory here available and me position my window.
So as you can see here, I have my Visual Studio Code open.
There's nothing right now there.
So let's create a file.
I'll call it task dot txt.
It's just a simple text file.
In practice, it would probably be a source code file.
Let's say hello world and break a line.
Okay, I got this file test dot txt.
Now I'm going back to the terminal.
I want to be able to version control this so that my changes are tracked.
So in order to do that locally in my own machine, I have access to the git command.
So you can do git space in it.
And this book created a directory called dot git and it will start keeping track of your changes.
As you can see, it said initialize empty git repository here.
If I do dear or LS if you're using Mac or Linux.
By the way, you need a dash a option to list and list hidden files.
My dot gets not appearing.
I need that option here, but I'll show you in Visual Studio Code.
Where is it?
Let me see.
One moment.
Let me show you here in Explorer.
New share.
So here's my file explorer or find your Mac or whatever you're using.
You can see there's not dot git directory there.
If you're a Mac, you can press command shift dot or period to show hidden files file names that started with dot.
They are called hidden files in Linux based systems.
So probably won't see it in your finder window if you're using Mac.
But this is directory that when we say git space in it enter that creates this directory.
And this is where all the git stuff is being tracked.
You don't really have to look into this directory at all when you're working with git.
But just so you know, if you have a dot git directory in your project, that means it's being tracked by git.
All right.
Everybody okay so far?
Okay, I'm going to clear my screen.
If you're on Mac, it's probably clear.
If you like doing that.
Anyway, so I'm first going to do git status.
This is a command to see what's going on with my files if I have any changes.
In this case, I just initialize what's called a repository.
This is what we call basically when you have git and your project wanted to keep track of changes.
The directory or folder becomes what's called a repository.
That's just the terminology.
If I say git status, it tells me status of the files that possibly have been changed within this repository.
You can see there's untracked files here.
Untracked files meaning they haven't been tracked by git yet.
So I need to tell git, hey, can you track this file so I can see the changes over time?
So to do that, it's a two-step process always.
First, you've got to specify the files to add to what's called the staging area.
If it's not staged, that means it's ready to be committed to the repository.
So it's a two-step process.
The first one is git space add, and you must say what file do you want to add to the staging?
What changes do you want to stage?
You can say task.txt.
That's the file that's untracked.
And if you do git space status again, you will see that we have now changes to be committed.
So this file, task.txt, has been staged for commit.
For those who just joined, we just started learning about git.
So make sure you have git installed and register account git hub.com.
What we did so far was create a directory called introduction-to-git.
I cd to that directory.
I ran the command git init.
Let me post to the Zoom chat the commands again in case you're lost, but those are just out of here.
In your terminal.
I posted it to the Zoom.
If those who just got here cannot figure it out, please let me know in the chat.
Somebody asked how to install git.
Like I said, I told you in the beginning that I'll send you the link again.
You probably already have it.
If you run the git commands and it works, you probably have it.
Let me copy and paste.
All right, let's keep going.
So like I said, I had an untracked file.
I git add that file so it's staged.
I'm always running git status command so that I know what's going on.
Now it's saying, OK, it changes to be committed.
So this is like green color if you can see the color.
So it's ready.
Now what we do the second part, right?
We do a commit.
So we're going to commit this to the history of changes.
So git space commit.
Now what I usually do is I like to use the option dash M, which means add a message to the commit.
So I'm going to say describe what I just did within quotes.
So OK, add task file.
Always make sure you're describing the changes that you made to the code.
That's very descriptive and specific.
So when I press enter, you can see I made a commit.
Now, how do I know the list of history code of commits?
Now you can see the log, git space log, enter.
And you can see there's only one commit and that's the one I just did.
And by the way, this is what's called the initial commit because I just initialized the git repository.
And the very first commit is called the initial commit.
So people like adding the message initial commit sometimes.
So you can see there's the author, there's the date and what's happening.
By the way, I didn't tell you how you can set your information for git like my name and email.
I can tell you right now.
Let's do that.
So usually when you make a commit, it will record who did what.
So we have to make sure to establish our identity with git program.
So to do that, we're going to run a git config option here.
So git config dash dash global space user dot name and then some quotes and put your name here.
Okay, so this is the git space config command, and we're using the dash dash global option for this user dot name.
And then you have to put your name here to identify yourself to git.
Somebody asked, has they revert back to calling the main branch of master branch?
Or is the git version stalled in your PC old?
Good question.
I was going to mention that when I talked about branches.
So when we have worked with git, we have what's called a branch.
And historically, it's been called master branch.
That's where all the like, think of it like a history timeline.
That's the stable program.
And if you need to add new features, you're going to branch off the main branch or the master branch and do your things that are not related.
And once you're ready to go back and add those new features, you merge back into the main or master branch.
Now, in recent times, they renamed that master branch to be called main.
So if you see main here in your git log, that's why the latest versions of get I think they're using main now.
And I don't know why I'm using master right now.
It's probably either I have a setting that I set to use master or my version, like you said, might be another version that's not yet set the default to main.
So it's up to you.
So I don't know what you guys see.
Let me know what you guys see here if you're using a git version that says master or says main.
But for all purposes, what we're doing, it doesn't really matter.
Okay.
Now we keep going.
No problem.
All right, so everybody got this commander.
Okay, make sure every character is correct.
There's a dot between username and so on.
So press enter.
I already did mine, so I'm not going to do it again.
So that should set your username.
The next thing is the email.
See there's an email here in the log.
So we're going to do the same get config space dash dash global space user dot email, and then quotes and put your email here.
Almost the same thing except after users dot email and then your email.
Let's enter.
I already did it so not going to do it again.
Okay, so when we do that change in the global setting for user dot name and email, that's actually a very simple thing that is doing it's simply changing a file.
And that file is called the dot get config in your personal home directory.
So I can actually see the contents of that file.
In my case, I'm using windows so I can do code space percent user profile percent.
This is the variable that gives me the path to my personal directory and backward slash dot get config.
If you're using Mac or Linux, this should be under dollar home slash dot get config.
And the dollar home you can also say tilde instead of that.
Okay, so if you want to open the file to see what's in there, this is the path to the file.
You can also open that and find your or explore or whatever in your home directory.
That's the directory usually see users your username or Mac slash user slash your username on Linux slash home slash your username.
Okay.
Anyways, I'm going to open that so you can see in my visual studio code.
That I can see now there's line for in my particular file I have other settings but you I don't know.
I think you're all if you're new to get you'll only see these three lines for user can see square brackets around the user.
And then we have key value pairs name it's whatever you set for your name and then email whatever you set for email.
So all those two commands did were right to this file.
So whenever you need to change your get username or email, you could also change this file and save it.
It will be the same effect as using the get config dash dash global command.
All right.
I'm going to close that.
Great.
Now let's make a change.
Let's imagine this is source code and I change hello to hello there.
And I save the file.
So I'm going to see in get.
I'm going to do get status again.
And you can see there's it says modified.
That's dot txt.
So that means I change this file.
And it's not staged yet.
So if I want to know what's happening here to this file, what did I change?
I can say get space diff diff is difference between the new and the old.
So you can see it's giving me the minus line and the plus line minus meaning I remove this line that said hello world.
Plus meaning I added a new line that says hello there.
So this is an addition.
And down is the subtraction.
So that means I changed basically I changed world with there.
So the colors is red for removal and green for addition.
And it tells you the diff.
Okay, so you can always leverage get diff to see what you changed.
If you're satisfied with this, we can make a commit, right?
That's just that process.
First, you need to state the changes with get add pass dot txt.
Now you can see if you do get status again, it says it's now green ready to be committed.
And then I can do get commit dash m and describe what I did.
Change road for there.
Enter.
Now I made another commit.
And I can see the get log.
Now there is one two commits.
The top one is the latest.
And you can see every commit has kind of an identifier.
This is typically called the commit hash.
Or Sha, okay, because that's the algorithm that does the hashing.
Secure hashing algorithm.
Okay, so if you hear those terms that it's coming from this, the commit hash.
What's the shaft of the commit?
And it describes what I did, who did it, and when.
Okay.
So so far, how is everybody doing?
Were you able to do everything and see everything so far?
Let me know in the chat.
Okay.
All right.
Great.
So I just explained you the basic flow and it's always like that.
You're going to make a change.
You're going to add and you're going to commit.
And you can check the status every time you to make sure what you're doing.
If you want to know the changes, get diff.
If you want to know the history, get log.
Now, if you don't remember any of this.
Now you can also get dash dash help.
And it will tell you some commands.
Okay, so you can refresh your memory.
Now, if you still cannot remember this, just go online, make it do a search.
Get help.
And it will point you to the website.
And you can click here documentation.
And it will see reference manual, for example, tells you reference get or figure whatever in it.
We did that, get add status diff commit.
So you can click there and see read more about it.
Okay.
Nice.
Looks like we can now do GitHub.
So this is all great.
We got our code version controlled.
We can keep track of changes.
But okay, just for us.
What if we wanted to publish this to the whole world?
Maybe want to make it open source so other people can help out.
So introduced GitHub.
Let's see what's the window.
So GitHub leverages get behind the scenes.
And if you created your account.
I hope everybody see my GitHub page I logged in.
And what we're interested right now is in repositories.
So if you click at the top right, you're going to see your repositories.
Click that.
And you can click here to new.
So basically what we want to do is the repository we have locally.
We want to be able to show that or send it to GitHub so that is hosted there as well in a remote place.
So you can click new.
And then what you're going to do is under your owner repository name type the same thing you typed for the local in my case was introduction to get separated by dashes.
This is going to be the repository name of GitHub.
Now you can choose to be public or private or just leave public by default.
And all the other stuff I don't care.
I just click create repository.
Now I created a repository on GitHub, meaning it's there so we can think of GitHub as another machine somewhere.
And they did the get init command there what we did in our local machine.
That's what happened when we did create repository on GitHub.
It's basically calling get init behind the scenes because GitHub itself is built around git.
Now what we have to do is sync these two.
Basically we've got to take our local and push what we call push.
Okay, those changes to GitHub.
Now to do that you're going to scroll down can see here.
There are two options of connecting with GitHub.
And one is HTTPS.
That's probably your default if you've never had SSH key.
I already have SSH so that's what I use.
So it's your first time it's HTTPS.
So you're going to copy this.
Either click this icon or copy from the box.
And you're going to go, let me do here.
To the terminal.
And we're going to say get space remote add origin.
And then you're going to paste whatever that link for GitHub was.
This is the GitHub remote command meaning you can add a remote location to this repository.
And I'm using add because I want to add a remote location.
And the name I'm going to call this like the name of the remote location is origin.
It's just the standard everybody uses.
They call it origin.
Okay, you could use any name, but it's just easy to follow what everybody does.
Enter.
What happened now you added a remote location you can verify if you say get remote space dash V or verbose.
And you can see I have origin set for this to fetch.
Patch means pull the code from GitHub.
Take it from GitHub and put it local.
And then we have also set for push pushes like sending it to GitHub.
Think of it like a upload and then fatch is download.
Okay, great.
Now we need to send the code from our location local to remote.
That's GitHub.
So that's called a push.
So we're going to get push.
And then we're going to use the option dash you to it's just an option that allowed to track the branch.
Just just add that origin and then the name of the branch.
Now, my default branch is master.
So if you want to know the name of your branch, let me first tell you that.
So I'm just going to copy this and do the follow get space branch.
If you just do that enter, it will tell you the name of the branch you're currently in.
In my case, it's master.
And there's a star next to it, meaning I'm right now in master branch.
If you're using the get with main, it will say star main.
Okay, so make sure you either use whatever is saying after the star.
Anyway, going back to get push dash you origin and space the name of the branch my case master.
If yours is main, you add main.
What's going on?
I put a typo here.
There you go.
Now, because I chose HTTPS, it's showing this thing of connecting to GitHub.
Let me see if I can share.
You can see that sign in with GitHub or whatever.
So you got to click sign in either code or browser.
I'll just do browser and see what happens.
So it's asking me about credentials.
Well, I'm going to click authorize get dash ecosystem.
And then it's asking me to use mobile to type a code, I think, because I have the GitHub app.
I don't know what your experience will be.
Right now I'm in my phone.
I have the GitHub app, so it asks me for a second factor.
So I type the code.
Let me know in the chat what your experience, what they ask.
So I authorized and let me share my CMD again.
Oops, that's the wrong one.
There you go.
So you can see here, after I authenticated that it sent branch master set up to track.
This is the dash you option.
And writing objects, meaning they sent all the stuff to GitHub.
All right.
Somebody said, I don't know why didn't it try to authenticate me.
I got personal problem.
Maybe I did authenticate my account before.
Yeah, so if you use HTTPS, it probably remembers if you did that again before.
Now, if you use SSH, it doesn't need any of this stuff.
It just works without any authentication because SSH is you already added your key to the account.
So make sure you, I don't know if you use HTTPS or Git app.
If you have Git app for the link, that means it's SSH.
Now, I haven't talked about SSH yet, but I can do that later.
Just a way for us to push without having to authenticate every time.
It used to be a password, but now it's with the fancy different kinds of authentication factors.
But in any case, let's look at GitHub.
So I'm back to GitHub in the browser, and I'm going to refresh.
And you can see, I can see, now there's the file class.txt here, and I can see the content hello there.
And that's basically what we had locally, but now it's in GitHub servers in a remote location.
So you have your code in your local machine as well as GitHub.
Now, going back in the browser, you can click this kind of icon of arrow going back in time to see commits.
And it will tell you all the history of changes that is the commits for this.
You see the top is the latest, the bottom is the oldest.
So I can see from the bottom, I click the commit short shot, and it will tell what change I made.
In the low world, you can see on the right hand side is what I added.
Now, this is the split view.
You can choose to have a unified view, which is everything in one thing.
And the split view is like left and right with left being before and right being after.
And it tells me who did what, when, just like we saw in the terminal with the Git log.
Of course, this is much nicer to see on GitHub because they made a lot of work to make it really nice to work with the source code.
And you can go back to the history of changes commits and click on the other one to see I left hand side was hello world.
And I changed that word to there, hello there.
And you can see this is the master branch.
See the master there.
Now going back, going back to the root.
So this is GitHub.
Basically, GitHub is like a social media for development.
It allows everybody to come together and collaborate on code, especially if it's open source.
Open source means your code is available to see for everybody to see.
And they can also propose changes and modify the code and work on it and propose help you out of the code.
Okay.
There are many other features on GitHub won't get to it today, but there are issues, which is like you can keep track of things you need to do.
There are pull requests, which is like proposing changes.
And their actions is like CI CD.
If you ever heard that term continuous integration and deployment.
And other things there.
Okay.
Now if everybody is on GitHub.
If you click the person's name.
That's your profile.
And it tells you, for example, the art contributions.
If you do open source, you can see this graph.
That's very popular thing.
Back in when GitHub had just come out, people are look at their GitHub pages and see what people are up to, what are the coding.
And you can see how often they code with this graph used to be a big deal.
If you want to other people to see your stuff or want to follow people around like you do on social media, you can always go to somebody's profile and click follow.
This is myself. I cannot follow myself. I do have followers and following.
So let's all follow each other.
Post your GitHub link there if you want to be followed.
It's like social media for coding.
Anyway, let's see how everybody's doing.
Let me go back to my repository.
Does that mean that I can have multiple remote repositories?
Yes, you can have as many repositories as you want.
Just go on GitHub and click create new and push your changes there.
In fact, many people have multiple repositories.
I do have many.
Yeah, a single project can have multiple repositories as well.
Maybe you have a repository for the back end, a repository for the front end, a repository for the mobile application, a repository for all your documentation, a repository maybe for your team to keep track of things and so on.
You can use GitHub in many kind of ways. You can be creative about it.
GitHub really made it social and they really innovated in the sense that they were using GitHub for pretty much everything they could do.
They were keeping track of documents on GitHub.
They were using GitHub to keep track of team.
It's what today people like using Notion or whatever stuff they track their work.
People could also do it in GitHub.
In fact, that's how GitHub itself does stuff.
People who work at GitHub and so on.
Okay, you asked since we add Git remote add.
Yeah, so that's a different thing.
You can have one repository and that one repository can be synced with many remotes.
That's also possible.
You could have, for example, some people are using GitLab.
That's like a competitor to GitHub.
What they do is they mirror the code to GitHub.
What they would have is one repository whose origin is GitLab, but then they add another remote for GitHub.
Every time they're working, they push to GitLab, which is their main code sourcing program for their team.
Then they also push to GitHub as a separate thing so that other people can also see that because maybe the company, despite them using GitLab internally,
most people will use GitHub, so they want to have an audience that's on GitHub, so they post there.
Think of it like a social media.
If you're a person on social media, you're posting to TikTok and you're posting to Instagram, but it's pretty much the same post, right?
So you can do that as well.
You have one repository and multiple remotes.
You're welcome.
I hope everybody got everything so far.
Please let me know if you haven't.
If you had trouble, go on Discord again and ask questions there.
Make sure to post your link to GitHub so we can follow you here, post in the chat or Discord or whatever.
We can follow each other.
I want to help you out with SSH now.
Let's try that.
Yeah, let's talk about SSH.
So if you notice, if I click code here, I can see HTTPS and SSH.
So in order to use this SSH thing, I'm going to teach you.
Are you going to post the video on YouTube after we're done here?
Yes.
Eventually, you'll be there.
If you really want the video, please send me a donation and I'll try to give you the unlisted version.
Otherwise, it will appear in a couple of weeks.
In any case, so the benefit of using SSH is every time you push or fetch from GitHub,
you don't have to authenticate in the sense of having to type password or having to go to that website, whatever just happens.
Obviously, it's authenticating using a key called SSH key, but it's so seamless that you don't have to do anything.
Now, in order for that to work, what you have to do is in your local machine, you generate what's called SSH key,
and then it's going to have two things, the private key and the public key.
You're going to take the public key and you're going to go to GitHub and put it there so that GitHub knows what your public key is.
Every time you try to connect, it will check your key to see if it's you.
Now, how does that play out here?
Let's go to the terminal.
I don't know if you already have a SSH key.
Typically, if you go to your home directory, there's a .ssh folder.
If I do a CD, % is a profile.
If you're on Mac or Linux, a CD tilde or dollar home, if you do that and if you try to CD to .ssh, if you have something there, you probably have a key.
If I can see deer, you see I have a key here.
If you see something .pub, whatever, these are my keys.
So I already have a key.
So make sure you check if you don't already have a key.
If you don't have a key, this is how we generate one.
You're going to use the ssh-keygen command.
So ssh-keygen space-t.
Now I have to say what kind of algorithm or the key, AD 25519.
So type it like this.
This is the recommend way to do today to generate a key using ED 25519.
And then space-capital C, capital C, be careful of the case.
And then quotes and within the open and closing type your email.
Probably want to use the same email that you did for git config here.
Okay, so ssh-keygen space-t, space ED 25519, space-capital C,
space double quotes or email double quotes.
Now if you mess up, don't worry, you can always recreate create new keys.
Now press enter.
Let's try it like this.
I don't even know.
And it's going to ask where you want to save it.
Typically it's in .ssh of your home directory.
And you can press enter there for the default.
I'm worried it's going to overwrite my thing.
So let me copy this and change somewhere else somewhere.
Now it asks for a passphrase.
You don't have to type one.
So I just press enter.
Same passphrase, just enter empty.
And then it generates this thing.
Now if I type dir again here, you see, for my case, it generated this somewhere
and somewhere.pub.
Now if you type the defaults, it's going to generate id underscore ed to 5519.
This is the private key.
Don't expose that one, okay?
The private one keeps yourself.
Now what you want to take is the public one,
which is id underscore ed to 5519.pub.
That's the one you want for GitHub.
So take this one, okay?
So I'm going to open that.
In my case, I type somewhere.
So I'm going to open that one.
.pub, okay?
Open that in the text editor.
Or you could type the command.
In this, for my case, windows, it's type.
For microlinux, it's cat.
If you want to see it in the terminal.
Otherwise, just open it in your text editor, okay?
So this is what it looks like.
It's very simple, but this one is one line.
So you're going to copy this, okay?
Copy everything.
Once you got that, go back to GitHub.
Now GitHub, you're going to go to your profile avatar, top right.
Click there.
You're going to go to settings.
And then you're going to click SSH and GPG keys, okay?
Click that.
And then at the top right, you're going to click new key.
Okay?
Now I'm going to go directly there.
And I'm posting that link.
If you cannot find it, that's the link on Zoom chat.
So this is going to add new SSH key.
So type a title for you to identify.
Okay?
So you know what this key is for.
Maybe you want to say username, add name of the computer, right?
Me at my computer's ABC.
So you remember where this is coming from.
And then here in the key, you're going to paste, oops, not this.
You're going to paste that thing that you got in the file for the public key.pub.
You're going to paste that, paste it here.
Then you click add SSH key.
So what this is doing is you're providing GitHub with the public key so that whenever you need to push something to GitHub,
GitHub will see that it's you, okay?
That way it does everything automatically.
You don't have to go through that authentication process.
Clicking the browser and logging in and so on.
I couldn't locate the SSH folder on my Windows 11 OS.
If you do not have .ssh folder, that means you don't have a key.
Therefore, you must create one.
Yeah.
Like I said, if you cannot find a .ssh, that means you don't have a key.
Therefore, you must use the SSH-keygen command to create one.
Let me paste the command again in a Zoom chat.
Make sure to run that.
It doesn't matter where you are, okay?
It doesn't really matter where you are in the file structure.
Just type that command with your email.
And it will generate that directory for you by default if you choose the default settings.
And after running that, you should have .ssh.
And then you just go there and open the .fub file or type it or cat in your terminal
and copy the content of that file.
It's just a plain text file, okay?
It's nothing special.
But just a plain text file, you can open in any text editor.
Or you can open it, or you can show it on the terminal.
On Windows, it's type, space, name of the file.
On Mac and Linux, it's cat, space, name of the file.
Okay, when you click add, SSH-key here.
Now I'm going back to that repository.
You're going to see if you click code, the SSH option, click that, and you copy this.
It's almost the same except they changed the beginning with get add.
I think that's all the, and there's a colon here.
Basically just copy that.
Now let's go back to the terminal.
I'm going to go back to my directory.
So I know it's cg.dot, slash dev, slash introduction to get.
Make sure you go back to your project directory.
Now I'm going to say get remote-v again to see that if you have a htps here, this will apply to you.
If you already have the SSH, you don't have to worry about this.
Now the process I would do if SSH, if I didn't have a htp, would be get remote add origin, and I paste that.
And if I do that, remote origin already exists.
So what I could do is just remove this one and add the new one.
So I think get remote, let's try this, remove origin.
Now if I type get remote-v again, there's nothing.
Now I can run get remote add origin with the SSH URL,
get.github.com, calling your username slash introduction to get.gith.
Now if you do that, type get remote-v again, you should see origin, get at.
That's how you know it's SSH.
And then you can make a change anywhere in the file.
Let's just change silly thing.
Going back to VS code.
Let's try SSH.
I added that to the file and save it.
And then I go back to the terminal.
Let's practice again.
Get status.
You see there's a test.txt.
Get add test.txt to stage those changes.
Now get status.
Get ready to be committed, get commit-m.
What did I do?
Added, linux, SSH, whatever.
Enter.
Get log.
You can see there's a new commit.
Now we are ready to push to get up.
So I can say get, push, that's you, origin, master.
Enter.
Now you can see it didn't ask for authentication,
because it automatically included my key, SSH key, and get a hub already checked,
and now it's good.
So behind the scenes, it's authenticating SSH keys.
So it's very convenient.
Back in the day, if it's HTTP, it would ask for a password every time I push,
and that's very annoying.
So this way is like, I don't have to type password every time.
It just does everything for me automatically.
Okay, I hope everybody got the SSH key and added to GitHub.
You change your remote to SSH so you don't have to manually authenticate every time.
So far, so good.
And we're out of time for today for this topic.
But I hope you learned something new.
There's a lot more to GitHub.
So make sure to go to share your GitHub, other people, and follow each other.
Start building some stuff there.
Write your code, push it there so other people can see, showcase your work.
If you want to collaborate other people, try to find another repository,
and you can try to think, propose changes to their code as well.
Add comments or whatever.
No comments yet (loading...)
No comments yet (loading...)
Did you like the lesson? ๐๐
Consider a donation to support our work: