Git & GitHub Crash Course 2025

Traversy Media| 00:49:29|Mar 26, 2026
Chapters25
Introduces the Git and GitHub crash course for 2025 and beyond, outlines the scope for beginners to intermediate users, and mentions topics like repository creation, staging, pushing, pulling, branching, merging, and CI/CD deployment with Vercel.

Traversy Media’s Git & GitHub Crash Course 2025 armors you with practical, beginner-to-intermediate Git skills: local setup, remote workflows, branching, PRs, and deploying with Vercel.

Summary

Brad Traversy delivers a fast-paced, beginner-friendly tour of Git and GitHub designed for 2025 and beyond. He starts by clarifying the difference between Git (the version-control tool) and GitHub (the hosting platform), then guides you through installing Git, configuring your user name and email, and aligning your default branch with GitHub’s main. The video moves into hands-on workflow: initializing a local repository, staging with git add, committing, and pushing to a remote repository on GitHub. Traversy emphasizes terminal mastery over GUI tools and demonstrates how to clone, fetch, pull, and push, plus practical tips like .gitignore usage and creating a README. He dives into branching and merging with real examples (feature/login), discusses pull requests as a collaboration mechanism, and shows how to handle remote branches, merge locally or on GitHub, and delete branches. The course also covers Git cloning over SSH (with key generation and adding keys to GitHub), forking, and working across environments. Finally, Brad demonstrates setting up a CI/CD pipeline by deploying a project to Vercel, illustrating how changes pushed to GitHub automatically reflect on the live site. The lesson is peppered with practical workflows, shortcuts, and tips to keep your Git discipline simple and effective in real-world projects.

Key Takeaways

  • Initializing a local Git repo creates a hidden .git folder (git init) and sets the stage for versioning your project.
  • Staging with git add and committing with git commit records changes locally; pushing (git push) sends commits to a GitHub (or other) remote repo.
  • GitHub is a hosting platform for Git repos offering issues, PRs, actions, and more; Git is the VCS, GitHub is the hosting surface.
  • Branching (e.g., feature/login) allows isolated work; merging (via git merge or PRs) integrates changes back into main.
  • Pull requests provide a formal mechanism for code review and integration on GitHub; you can merge or close PRs as the repository owner.
  • SSH keys enable seamless, password-less Git operations over SSH; generating keys and adding the public key to GitHub enables cloning and pushing via SSH.
  • .gitignore prevents sensitive or unnecessary files (like .env) from being committed to the repository; use it to protect secrets and reduce repo noise when sharing code.

Who Is This For?

Essential viewing for frontend/backend developers and students who want a solid, actionable grounding in Git and GitHub, plus a clear path to CI/CD deployment with Vercel. Great for beginners who know some Git basics and want practical, production-ready workflows.

Notable Quotes

"git is a distributed version control system or VCS and it helps developers track changes in their code base."
Brad defines Git’s core purpose early in the intro slides.
"GitHub offers you, you know, powerful collaboration tools like bug tracking, feature requests, task management, wikis for your projects."
Explanation of what GitHub brings beyond Git.
"The very first thing you want to do when you create a project and you want to use git is you want to initialize a local repository and you do that with git init."
Concrete, actionable step demonstrated in the workflow section.
"You can create a new branch, make a change, and then merge those changes into the main branch and this is a common workflow in git."
Summary of the branching/merging workflow.
"Pull requests are your collaboration mechanism to merge changes into the main code base on GitHub."
Highlighting PRs as a collaboration pattern.

Questions This Video Answers

  • How do I set up Git and GitHub for a new project in 2025?
  • What’s the difference between Git and GitHub and why do I need both?
  • How do I create and merge branches in GitHub manually using the CLI?
  • What is a GitHub pull request and when should I use it?
  • How can I deploy a GitHub-hosted project to Vercel for CI/CD?
GitGitHubGit BashGit CLIbranchingmergingpull requestsSSH keys.gitignoreREADME.md (Markdown)","cloning","forking","CI/CD","VerceI"],
Full Transcript
hey guys welcome to my git and GitHub crash course for 2025 and Beyond so I figured that this would be a good idea for the first crash course of the year because git is something that absolutely every developer needs to know at least the basics of and I do want to stress that this is a crash course meaning that we don't dive super deep into really Advanced topics this is more for beginners as well as intermediate developers that may know just the very basics of git and want to learn a little bit more so we're going to cover all the stuff that you need to know such as creating a local repository staging pushing to a remote GitHub repo pulling branching and merging and more and we're going to start with some slides just to go over what git and GitHub is and just some of the fundamentals and then we'll jump in and we'll start using Git along with GitHub and I'll even show you how to deploy a project using cicd which is continuous integration and continuous deployment we'll do that with GitHub and uh a company called versel all right so let's get into it all right guys so I just want to go through some slides talk a little bit about what git is what GitHub is and look at some of the the key features and so on so git is a distributed version control system or VCS and it helps developers track changes in their code base also allows them to collaborate with others and manage multiple versions of a project project and in its absolute simplest form and simplest use case it's used to back up your code now unlike other Version Control Systems some of the older ones git is decentralized meaning that you don't need a central server to use it instead every developer has a full copy of the repository on their local machine and a repository you can think of as a like a digital filing cabinet that stores all your files and all the changes that you've made so it's kind of like a time machine for your code and you can roll back to certain versions when you need to so Version Control is a musthave skill for any developer it's used in almost every software project and if you think about big companies like Google Facebook Microsoft they have thousands of developers that are working on the same giant code bases and they need a way to to manage all the changes that are made and that's where git comes in it allows developers to work on the same Project without stepping on each other's toes and it also provides a way to track changes roll back to to previous versions and it's used for anywhere from you know a one person to Giant companies like Google and Facebook now just to go over real quickly the key features of git it's distributed it's decentralized so there's no need for a central server it keeps track of changes made to your codebase multiple developers can work on the same project you have branching which we're going to talk about more in a little bit but if you want to create a separate Branch to work on outside of your your main branch your main code to either create a feature or fix a bug you can do that and then when you're done you can merge it into the main branch into the main code you have the option to work with uh remote repositories like GitHub but there's others as well such as gitlab and bitbucket um extensive tooling so get is supported by many tools including idees and we're going to learn about the the workflow soon when it comes to get but in addition to your repository there's also a staging area that you can utilize that you can put files before you actually commit them to your local repository the speed so git is very fast and efficient uh it also uses sha one hashing to ensure data integrity and of course it's open source and free it's it's widely available without licensing costs it has a large community and support for plugins and things like that now there are are other version control systems like sub verion or S SPN but git is by far the most popular version control system today for the reasons that I mentioned it's fast it's efficient decentralized now this chart is from the stack Overflow developer survey of 2022 and it shows that almost 94% of developers use git over other Version Control Systems which is a huge number and they didn't even have this this question in the 23 and 24 surveys because it's just so obvious that you know everybody uses git now I want to talk a little bit about GitHub because some beginners can confuse git with GitHub but GitHub is a web-based platform designed for Version Control and collaboration and it hosts G repositories remote repositories and provides a graphical interface within the browser to manage your code and do other things as well um in addition to hosting your code GitHub offers you know powerful collaboration tools like bug tracking feature requests task management there's wikis for your projects so git is the tool that you use to create these repositories and and push your code to them but something like GitHub because there's others as well it's not just GitHub but these kind of remote Services um this is where most of your collaboration is going to happen this is where people are going to pull your code from and make poll requests and add issues and things like that so it's important to to note that git is the version control system while GitHub is the platform that hosts git repositories all right so when it comes to installing git there's there's multiple ways to do this and it really depends on the system you're on so if you're on Mac OS you can use the Homebrew package manager if you're on Linux you can use whatever package manager for whatever Dro you're using if you're on Windows or or any platform for that matter you can download get from the official webs s it which is get- scc.com and when you download the installer on Windows you also get a really cool terminal program called git bash which is a Unix like terminal for Windows and even though the windows terminal has gotten a lot better over the years I still prefer to use git bash on Windows but that's just me so when it comes to using git you have two options you have the the terminal where you write you know type commands and then you also have tools with graphical user interfaces now I recommend learning git using the terminal it's it's more powerful and you'll have a better understanding of what's Happening behind the scenes um when you use an interface it's still doing the same thing that you would do in a terminal but you're not seeing what's actually happening and the commands that are actually being run and then I would say once you're comfortable with the terminal you can try out a guy um there's many available like GitHub desktop Force tree git Kraken um if you're using visual studio code or other IDE there's usually well for visual studio code there is built-in git features and for many other idees there are as well but again I would say get comfortable with the terminal first now when you start using git you do have to configure it initially with your name and email address this is important because every git commit uses this information and you can set this with the these commands here get config and then-- Global username and then your name and then same with email now I want to go over the workflow of git and and you're going to learn more about this at when we actually do it this is just kind of an overview so if you look at the boxes at the top you have your working directory and this is on your local machine you have your working directory this is where you make changes to your files you have the staging area where you PR prepare your files for commit and then you have the local repository where git stores all the changes you've made to your files and this will be all stored in a hidden folder called dogit in your project directory and then the remote repository whether that's on GitHub or gitlab or wherever that is that's stored remote and people can then pull that code down and so on so I just want to go over kind of the workflow and the commands that you'll run to move files around to these different areas and again we're going to be doing this so this is just an overview so first off you're going to run get and knit and that will initialize a new repository in your project folder or your working directory and it'll be a hidden folder called dogit then once you're ready to add some files to the staging area let's say it's your initial commit or you added a a new feature or you fixed a bug or whatever it might be you add it to the staging area with the get add command and then when you're ready to commit it to your your local repository you would run the get commit command and you add a comment explaining what that commit is okay once you're ready to push to your remote repo whether that's on GitHub or gitlab then you're going to use the get push command and this is after you configure your remote repository because it has to know where it's actually going to be pushed to and I'll show you how to do that now when you want to pull changes from a repository you would use the git pull command that's going to pull the files down to your working directory all right so let's say one person makes a commit and they push to GitHub and then another developer wants to get those changes and they're already you know they already cloned the repo or whatever then they would just type get PLL and that will get the latest changes now once you go to a repository for the first time and you want to get that get those files on your machine there's a few ways you can do it you can click the download button and get the zip file but you don't really want to do that if you're going to continuously work on the the repository so you would use the get clone command and that would pull the entire thing onto your local machine now branching is a key feature of Git it allows you to work on new features or bug fixes without affecting the main code base so you can create a new branch make a change and then merge those changes into the main branch and this is a common workflow in git and you can also create branch branches for different environments like production staging and development so let's say you have a project that logs workouts and you want to add a feature that calculates the total calories burned so you can create a new branch called feature SLC calories and work on that feature and then when you're done you can then merge that Branch back into the main branch and this is called a poll request okay you're requesting that your changes be merged into the main code base so this is uh again a common workflow in git so I think that that's all I want to talk about in the slides so kind of a general overview now we're going to jump in and I'm going to show you how to actually run these commands how to create a local repository how to create a remote GitHub repository how to push it how to pull make changes Etc so let's get into it all right so first thing you want to do is get get installed if you don't have it already and you can check by opening your terminal and just saying get-- version that'll show you the current version if you don't have it then like I said there's a few ways you can install it you can use home brew on Mac or your Linux package manager or just go to get- sc.com downloads and download it for Windows Mac or Linux all right so once you get it installed we're going to have to configure your your name and email and this is something you do just once the first time that you you're using git so you just want to open up a terminal it doesn't matter what folder you're in at the moment I'll get into what this task track tracker is in a minute but we want to run two commands so you're going to do get config and then d-g Global and then you want user.name and then whatever you want to specify as your name so I would say you know Brad traversy okay I'm not going to run that because I already have it set and you can check what's that by just taking the value away and just running this so you'll see that's what I have as my name all right then you're going to want to do the same for email so that would be user. email and then you would put in you know whatever email that you're using okay so that's how you can configure that now there's one other thing that I would suggest configuring and that's your main the name of your main branch because by default with Git it's called Master but with GitHub they changed it from Master to main so you can check What It Is by doing dash dash Global and then it's init do default Branch okay and you'll see mine is main because I changed it but yours might say master so what you can do to change it to match githubsign to talk about the project which doesn't really matter because that's not the focus but I have a download downlo uh a link to a download in the description to this task tracker zip file which has an index HTML a script JS and a style CSS and it's just an example of a project that we're going to use to make changes commit to our repository push to GitHub Etc if you want to use some other files that you create on your own that's absolutely fine but I figured I'd just give you something to work with and the reason that I put it as a download and didn't add it to you know its own repository for you to clone is I don't want start with cloning I want to start as if this were your own project all right so just download that and you can see I'm already in the the task tracker folder and I could do everything from here in my terminal but I'm going to open this folder up in vs code so that I can use the terminal here and we can actually see the files okay because there are some some git Integrations with VSS code and even though that's not the focus of this tutorial the focus is the you know the commands and the term we still have that as like a you know visual confirmation of what's happening so just to kind of go over these real quick very very simple I just have an H1 and a UL here so we have a script.js with just a console log and then a stylesheet with a little bit of CSS so again this what's in here doesn't really matter so the very first thing you're going to do when you create a project and you want to use git is you want to initialize a local repository and you do that with the command get ini it okay if you remember if we look at this slide here we run get in it that will initialize a new repository and it creates this hidden dogit folder right so if I were to do an LS so list my files and show hidden hidden files and folders it shows this dogit that's my git repository if you wanted to completely get rid of it you could do rm-rf and then doget and that would completely delete it all right so and you can see that a couple things happened within VSS code one it shows my Branch name down in the corner Main and it also changed the colors of the file names and put this U next to it so this just represents files that are untracked okay the U and the green coloring which means that I haven't added them to my staging area because remember there's a a staging area right and then there's our local repo where we commit to so we haven't done anything with these files yet so they're untracked now there's also a source control tab here and you can do everything that you can do within the terminal with Git commands you can do here as well but this isn't a tutorial on vs code so I'm not going to get too much into that but it does show you which files you know are untrack and it shows you the status now to check the status within the terminal you can do get status and that shows us that we have three untracked files okay so what we would do next if we look at the workflow here is we would run get add and add files to the staging area so typically what you'll do is you'll work on your project get it to a place where you know you want to save it essentially and then you want to run get ad and typically you'll add all so all your files but I just want to show you you can add them individually so if I do get ad index HTML now in vs code just to show you as a visual representation it has an a next to it it says index added so this file has been added to the staging area and if I were to run G status it shows me that okay so this here and then these two are still untracked so if I run get add dot or add all now they all have an A next to them and if I run get status status then you can see that they're all now in the staging area to be committed now to commit let see so to commit we run get commit and that will commit files to your local repository not your remote not GitHub or anything we haven't set any of that up yet this is all local so let's go ahead and run get commit and what you're going to do is add the dhm flag and add a message in quotes So typically when it's your first one you'll do something like initial commit so if we run that now you can see the files are no longer green over here they're white with no letter because now they're it everything's up to date the everything's added to the local repository if I run get status it says nothing to commit working tree clean because I've committed everything now from here you have the option of either adding your remote repository with GitHub so you would need to create one on GitHub or you could just keep working locally for now so for instance if I want to you know make a change and I'll just do something silly here I'll just add another task right so now if I save that you can see that this has changed color now to Orange which means that this this file has been changed from the what's in the local repository so you go through you make some changes you add a feature you fix something whatever it is and then you're going to add again so just say get add all which is only going to add the index file because that's all it's been changed right so now that gets added now you want to commit it so let's say get commit dasm and and I'll just say added new task okay so now that gets added and now I have uh my repository up to date and you can also run get log which will show you your commits starting with the most recent first which is added new task shows me the author the date and the commit hash and if I click the down arrow you can see that it goes to the next one which is initial commit and then to to get out of this you just hit Q to quit so that's going to be your workflow as you make some changes you add a new feature whatever the the change might be you add the files to your staging area and then you commit them okay and we're not dealing with a remote repository just yet but as far as frequency goes it's really up to you some people will will commit really often some will only do it after major features it's really just based on your your preference all right so now what we're going to want to do is the next step which is going to be git push where we push to a remote repository and that could be GitHub but it could also be gitlab bit bucket or or something else um so what we're going to do is set up a GitHub repository because right now we don't have one to actually push to so you're going to want to go to GitHub if you don't have an account create one and um you can list all your repositories that's what you see here um you also have a profile that will show your most popular repositories and also your contribution grid here so basically the lighter the green the more contributions like this day November 30th I had seven this day I had three and then the blank ones I didn't have any contributions meaning I didn't push to GitHub all right so what you're going to want to do is create a new repository with this right here it's a plus sign and the new repository you're going to name it typically you're going to call it what your project or your folder is called which in my case would be task tracker and I'm just going to say demo project for tutorial I'm not going to keep this now here is where you choose if it's public or private if it's public anyone can go to this repository and anyone can see the code all right so keep that in mind I'm going to make it private because I don't want people seeing this because it's just for this video um and it's nothing that I want anybody to have because it's just nothing really and then you can also initialize a a read me file I typically don't do this I create it myself and then and then push it but you can do that here you can also add a do get ignore file which I'll talk about in a little bit but again I add that myself so let's say create repository now it shows you basically the steps if you're creating a new repository or if you're pushing an existing repository which is what we're doing we've already done this the init the commit the add so basically what we need to do is first run this command so this will add the um this this repository as our remote so I'm just going to paste that in here so it's get remote add and then origin is just the name of the or the Alias of the of the repository so you can name it whatever you want but typically I'll just keep it as origin and then we're just adding the the address to the repo which is my username okay yours will obviously be your username slash and then whatever you called the Repository so I'm going to run that it's not going to do anything but it it did add the uh the remote repository so next uh let's go back here so we want to make sure that we're using the main branch I mean we don't really have to run this but I usually do anyway so we're just saying we want to use the main branch um and then we want to finally push so we're going to run this get push dasu origin main now we only have to add the dasu which stands for Upstream and then origin main we only have to add this this time any other time that we push in the future we can just simply run get push after we commit to our local repository so keep that in mind um so we run that and then you can see that it gets pushed to GitHub now if I go back to this page and I reload we see our code so we have the three files in the repository okay this is private so nobody can see it unless I give them permission if it was public anyone could go to this link and they would see your codee now what shows here is whatever is in your readme file your readme.md which is a markdown file and we don't have one so that's why it says add a read me and we can do it from here or we can what I'll usually do is create it on my you know create it on my machine and then push it but I want to show you how we can pull stuff from the repository so I'm actually going to add the read me from here so I'm going to click that button and then I'm just going to add a number sign and we'll say task tracker now this uses markdown syntax and if you use a a number sign that's going to be an H1 right if I use two that would be uh you know this heading would be an H2 if I use three that'll be an H3 and so on and I have a full crash course on markdown if you want to check that out I'll I'll put try to remember to put that link in the description so I'm just going to say this is a demo project for my git tutorial okay and this is where you'll usually put things like the usage so what do you have to do to run this if you're building something with node.js you would you would say you know run npm install to install any dependencies uh npm run Dev to run the server you just want to give full instructions on how to use this project okay but this is something very simple so I'm just going to add this and you can see the preview as well as to what it will look like which it will look like like this so I'm going to commit the changes and this does a commit just like we did from the terminal and you can add a description I'm just going to do create readme and then we'll say commit changes now we have a readme file here however we don't have it here so what we would do is we would pull the changes from the remote repository all right and we would do this if someone else had um you know cloned the repository made some changes and then put push to it we would need those changes so that would be this step here which would be a get poll okay so let's go ahead and run get poll and now we have the read me here okay because it pulled any changes from the server now the next thing I want to talk about is theg ignore file which is really important because you're going to have some things in your your project that you're not going to want to push to GitHub so for instance you might have a EnV file that has environment variables which can hold things like API keys and stuff that you definitely don't want the public to see so let's actually create a EnV file and let's say we have something like API key and we have it set to whatever one two three doesn't really matter so you're not going to want this to be available in your repository especially if it's a public repo right so what you would do is create a file called dotg ignore make sure you have that dot and then anything you put in here is going to be safe and not push to the repository so I'm going to add EnV all right so I'm just specifying that I don't want this file to be in the repository right so now let's make um another change we'll just go ahead and add another task I guess and then I'm going to say get add all and get commit and let's say added Task 5 and then if I want to push I can just say get push I don't have to do the you know the dasu origin or anything like that so I'll go ahead and push and then if we check out the geub repo I'm just going to reload this you'll see that we have our doget ignore we have the latest commit which is added Task 5 but the file is not here okay I have it in my in my directory here but it's not included in the actual repo now there's a couple shortcuts that I want to show you as well so if you if you want to add and commit at the same time in one command you can do that with the with the a flag - A so let's say I add another task here and when I'm adding these tasks this is just an example U normally you would be adding a whole new feature there'd be multiple files changed but I just want to make some kind of change so let's say that I want to I want to add and commit in one command so I can do get commit remember I haven't added this the index HTML to my local repository yet or I sorry I haven't added it to the staging area but I can do Dash a and then also M for the the message here and then I'm added added task six okay so if I run that now say get status and it doesn't show anything in the the the staging area if your branch is ahead by one commit so I can now just run get push okay and now if we go back to our repository we should see the new commit you can see added task six all right so that's how you can do it in one command another thing you could do and I'll just again add another task just to make a change another thing you could do is say get add and let's say index.html and then we can do double Amper samp so and get commit dasm and let's say added task 7 so here I'm doing the get add and the get commit in one command as well and then we'll do get push check it out and we should see added task 7 okay and it's only going to be on the files where that were changed and this case only the index HTML was changed now while we're on the the the GitHub repo here the interface just want to go over a couple things and just to get you a little bit more familiar so obviously it shows our files it shows the commits and it shows when they were made um here is the branch Main Branch if I had other branches then they would show here as well um over here it says six commits so that's what I've made so far and if I click on that it'll show me all the commits that that are made and it breaks it up by day and if I want to see the state of the code in one of these commits I can do that so if I click on add new task it shows me um what was actually changed at that point and what was changed was I added uh a new task I added task four all right so you can always go back and and check what was actually added or or removed or whatever was changed okay and let's see we have up here A bunch of tabs of course the code tab that's what we're on the issues tab so people can submit issues so if they run into a bug or something they can do that and they can add labels to them um poll requests so if someone wants to collaborate and they fix a bug or they add a feature they can then make a poll request for you to look at and approve so all your poll requests will show up here actions so here you can set up continuous deployment and continuous integration pipelines um that's beyond the scope of this tutorial and then projects so here you can manage your your project using github's built-in project management tools uh Wiki so if you want to create a Wiki security has to do with your security policies um insights so you can see you know the traffic and analytics um settings so from here you can do things like change the visibility so if you want to change it from public to private if you want to disable issues if you want to delete the repository arive it transfer it so all that stuff is done in the settings tab or and also add collaborators that's another important one so if you want someone else to be able to to work on this repository you would just add their their GitHub email here and that would send an invite to them um you can do more advanced stuff like web hooks there there's a lot you can do here I'm just scratching the surface just to you know just to give you an introduction but yeah there's a lot you can do it shows here the languages so whatever Technologies are actually used in the repo um but yeah so that's kind of the basics now let's talk about getting code from GitHub okay and we've already looked at PLL which is is one of the ways now you can download an entire zip of the the repository if you go to this code button here and you just say download zip but you're only going to do that if you just want the codee and you don't want anything else to do with the repository you don't want to add to it you don't want to you know do anything with it it still I would say clone it anyways uh because it's literally just a command and you have the whole thing on your machine rather than extracting a zip file and so on and that's the next one which is get clone you copy uh Co you get a copy of the full repo onto your machine right so to do that you would run get clone and you can clone with the SSH H link here or using htps now to use SSH you're going to have to generate some SSH keys and add them to GitHub I'm going to show you how to do that in a minute um another thing you could do is get fetch which is going to it's it's when you want to get the latest changes from the remote repository but you don't want to merge them so you can use get fetch and then forking is copying a repository from GitHub onto GitHub within your own account right so if someone else you'll see I can't Fork my own repository but if I was on uh if someone else was on this and they wanted their own copy of this on their GitHub account like let's say my username was hello it would be hello slask tracker okay and I could Fork it by just clicking this button and I'd have that automatically in my account then I could clone that onto my machine and I could work on that which would be my own repository all right so those are the the main ways that you would get files from GitHub now I want to go over cloning so like I said before you can clone using this SSH link right here you need to generate some keys and put them on GitHub so the way you would do that let's just jump back into vs code here just going to close that up so the way you would do that ssh-key gen that's what we use to generate a new SSH ke pair and then we'll do dasht so the type would be RSA and then the bits so Das B would be 4096 so if I run that it's going to ask me the location and the name of the key and the default would be in my home directory and then in a SSH folder which is a hidden folder and it would call it ID RSA and if you're fine with that you can just hit enter but if you want to change it then you would put the location so for me let say users Brad traversy obviously yours would be a different location at least I hope so and then SSH slash and I'll usually call it like idore GitHub we'll say GitHub 2 okay and you can add a passphrase if you want I'm just going to hit enter for no passphrase and now you can see that it's created this so two things ID GitHub 2 which is your private key and ID GitHub 2. Pub which is your public key all right now what you would do is is put the public key on GitHub so the way that we can read that public key to copy it to put it on GitHub is with the cat command so we'll say cat and then the tild day which is just an alias for your home directory slash. SSH and then SL idore GitHub 2 and then we want the pub public key so Pub and there it is so what you would do is copy this so from here the SSH RSA to the end so you copy that and then you'd go to GitHub go to your not your repository settings but your actual settings which are uh right here and then go to SSH and gpg keys and then new SSH key and then you just give this some kind of description like you could say I don't know basement um this isn't Windows basement Mac something like that that just describes your computer your machine ADD SSH key and then that would get added to your account all right and you can test to see if that works by doing SSH duper case T and then get github.com and I get this success message okay now if you get something that says like public key denied or something like that you usually what will fix that is to get your agent running so eval and then in back ticks SSH Das agent and then um whoops still within back ticks DS okay and you'll just see like this Agent P and some number then after that you would add the key so SSH Das add and then locate the key so home directory sl. SSH slash and then whatever you called it so ID GitHub GitHub 2 and you wouldn't put the pub here you're adding the private key and it says identity added so once you do that then you can try try that again and hopefully that works all right so now you're ready to clone if you want to get this like let's say we're on a different machine and we want this task tracker application we want to clone that Repository onto the machine so what I'm going to do is open up um let's see I'll just create a new folder I guess and I'll just call this let's say task I guess I'll say Tas tracker -2 and then I'm going to open that in my terminal okay so now I want to clone the repository into this folder so we'll say get clone and then you're going to grab's see we're going to go to repositories go to the task tracker and then I'm going to go to code and then get this right here copy that paste that now if I just run this as is it's going to create a new folder called task tracker if I want to take the files and put them into this folder of task Tracker 2 then I'll just put a dot at the end so now it says close cloning into now if I do an LS you can see I have those files and then you can continue to work in that folder on a different machine now I'm going to go back to where I was here in the first task tracker and I want to now talk about branching and merging so branching is a key feature of Git it allows you to work on new features or or bug fixes without affecting the main codebase and you can create a new Branch you can make changes and then you can merge those changes back into the main branch and this is a common workflow in git you can also create branches for different environments like say production staging development so let's let's go ahead and create a new Branch let's pretend that we're creating a login for this this project so what I might do is create a new Branch so I'm going to say get checkout so checkout dasb so I'm checking out creating and checking out a branch and I'm going to call it feature say feature and let's say slash login that's a common naming convention it's feature slash and whatever it is um you might also have like bug slash whatever bug you're fixing so let's do that and not only did it create the branch but it also switched us to the branch and you can see which branch you're on with get Branch so you can see that there's two there's Main and there's feature login and that's the one that I'm on all right so anything that I do from this point on on while I'm in this branch is only going to be on that Branch so I'm going to create a new file here called login. HTML and normally you'd create you know the whole login functionality not just the page but again we're not doing that that's not the focus of the tutorial but what I'm going to do here is just copy the index HTML and paste that in here and then we'll just change up some stuff like we'll just add login to thep title and let's change the H1 here to login and let's see we're going to get rid of this ul and we'll add a form and in that form let's do form Dash control and I do have some classes in the CSS to make this look somewhat decent we'll just have label uh label then an input and then let's go under well actually we'll just copy this down and then let's change this actually we'll change all these to password okay change the type to password as well and then we'll go under that div and we'll add a button give it a class of BTN and we'll say login all right and then just to check out what this looks like if we go to I'll show you the index page doesn't really matter again it's not about this project but it just looks like this right and if I go to the login so slash login. HTML then it looks like this all right so let's just say we just added the whole login functionality so I want to obviously add that to my staging area first so get add I'll just do get add all and then we want to get commit and let's do Dash M and say added added login page so now that's committed to my local repository now I'm going to push it to GitHub but it's still I'm going to push it in the feature Branch so let's say get push and then I'm going to do dashu origin and then the name of the branch which is feature SL login now when I go back to my my code here my sorry my repo we're going to see this window it says compare and poll request because we can make a poll request to merge this into the main branch and you can do that as a separate developer you know if you just if you're working on an open- source project and you create a feature or you fix a bug or whatever this is how you would create a poll request all right but if I don't want to merge that into the main then you're going to still see right here feature login so when I'm on the main branch we don't see the login. HTML right but if I switch to the feature login then we do see the login HTML so you can switch between branches here now let's actually make this a poll request so I'm going to click this button here and you just add a title to the poll request add a description and then create all right and then the owner of the repository will then go into they'll see that there's a poll request you can see there's one here and they can check it they can click on this and check the code and then they can choose if they want to merge that poll request so I'm going to say that I want to merge that poll request confirm merge and now pole requests success successfully merged and closed and then you can choose to delete the branch as well so I'll say delete Branch now if I go back to my code you can see that there's no there's no more branch on the remote repository and the login is now merged into the main branch all right now back on this machine what I can do is switch back to the main branch so we'll just get rid of that let's say get and then we want to check out that's how we can switch branches we want to check out uh main so now I'm on the main branch and then you can see that the login isn't here because I'm not up to date with the the latest changes on the remote repo so what I'll do is I'll say get poll origin and I want the main branch so I'll do that and now the login is now there okay so I'm up to date with the the latest uh the latest changes now if I say get Branch locally I still have that feature Branch right because I didn't delete it here and and you can actually you can merge it into the main branch on your local machine as well before you actually uh push it to the the repo so I could say get merge and then feature slash login I'm not going to run it because I've already pulled down the latest changes but that would merge it into the main and then I could push to the the remote repo so there's a lot of different ways to do things now I want to delete the feature login Branch locally so it's already deleted on the remote so let's say get branch and then we would do dasd and then the name of the branch which is feature SL login and now that Branch should be deleted if I say get Branch then we just have the main and we're all up to date so that's how you can not only create branches and and merge but also how you can create poll requests now the last thing I'd like to show you is how to set up a cicd pipeline with continuous integration continuous deployment with versel which is a great hosting company with a very generous free teer so there's nothing you have to pay or anything like that and this is great for hosting small projects so let's go to ver.com now I'm already logged in you're going to have to just log in with GitHub or whatever they offer I forget it's been so long um but you'll get this hobby package so I do have a pro package as well but I'm using my hobby which is the free one and all we have to do to get this task tracker deployed is simply click add new project and then since I'm I logged in with GitHub it there's they have access to it and I can choose the task tracker right and then down here since it's just a basic just it's basically just an HTML file with a little bit of styling there's nothing I have to add as far as you know build and output settings or environment variables um if I were using environment variables I would take the ones that are in the EnV and I would add them here on my server but I don't have any so I'm just going to click deploy all right so that was very quick because it's basically nothing and then I can say continue to dashboard this is the dashboard for my project if I click on the if I click on visit it takes me to the project which is now deployed publicly at this domain and if I go to SL login. HTML takes me to my login page okay so it's as easy as that now if I make a change right so let's look at the deployed version we have what five tasks so I'm going to come back here and I'm going to add another say six and then I'm going to go ahead and say get and I'll just do commit am and say added new task and then get push and of course you can use the The Source control tools as well maybe I'll do another tutorial on that but like I said for this I just wanted you to get comfortable with the terminal so if I go to versel and I go to deployments you can see that um add a new task is the latest deployment and it happened really quick because it's such a small project and then if I go back to the deployed version and reload there it is Task six so it's as easy as that now if if you guys have been around for a while and you know you remember using like filezilla and stuff like that it's it's a lot different now and it's a lot easier um you know once you know how to do it so uh yeah I mean versel is a great platform they're not sponsoring this in any way and there's a lot of different options and things you can do which I'm not going to get into but I just wanted to give you an example of how simple it is to um to deploy a project using GitHub and and um cicd with versel so that's it guys please give this a like if you enjoyed this if you learned something from it and I will see you next time

Get daily recaps from
Traversy Media

AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.