How to Install and Configure Git and GitHub on Windows 11

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey guys in this video I'm going to show you how you can install git and configure it with GitHub on your windows 11 operating system so let's start with the installation of git so for that just open your favorite browser and search for git and the first link which will appear here will be from git hyphen hcm.com which is the official website so we are going to click on this link and once we are on gitscm.com website you will be able to see this download for Windows button here so I'm going to click on this download for Windows button where you will see few options so let's click on this link you can also see there are some Standalone installers and portable installers we will just click on this link which says click here to download which is going to start the download of this executable file which is a very small file so and once this executable file is downloaded just click on this file I'm going to minimize the browser and here first of all you will see this kind of window which will say do you want to allow this app to make changes on your device I will click on yes here and you can see the setup for git has been started first window will be about the public license so just uh click on the next button here this will be the location where your git will be installed so if you don't have the good reason to change this location just leave it as default and then click on next and then you have this select component window here so you have the option to uh click on this checkbox which will add the additional icon on your desktop and all the other options are there so I'm going to just check this checkbox which says additional icons and leave all the other icons as checked and then click on next and then select start menu folder I'm going to leave it as default and then click on next and then you have choose the default editor by using git so you can see there are lots of editors here right so for now you can choose uh for example Visual Studio code as your default editor or whatever editor you have on your windows 11 operating system you can choose that editor and then click on next and then on the next window you have adjusting the name of the initial Branch so on this window what I generally like is I like to uh choose this option which says override the default Branch name for the new repositories and I generally name my default Branch as main the reason behind this is when you use git with GitHub the default Branch name on git is Main and not the master right so just click on override the default Branch name and then give the name main here and then click on next and then adjusting your path environment you have the option to use git from git bash only you have the option to use git from the command line and also from third party software I will go with the recommended option and then click on next and then you have choosing SSH executable use bundled open SSH and you also have the option to use the external open SSH executable file I will leave it as default and then click on next and then once again leave it as default click on next and then configuring the line ending conversion we are on windows so I will leave this as default once again and then click on next and then configuring the terminal emulator to use with Git bash I will go with the recommended one and then click on next and then you have to choose the default behavior of git pull so I will once again choose the default one and then click on next and then you have get credential manager so choose the credential helper I will choose the get credential manager here which is recommended and then click on next and then enable file system caching click on next here configuring experimental options so you have you can enable the experimental support for sudo consoles and then I mean and also enable experiment built-in file system monitor I will just choose both of them and then click on install which is going to start the installation of git so now as you can see the git setup is finished and you can even launch the git bash using this checkbox I'm going to uncheck this checkbox which says view release notes and then click on finish which is going to launch git bash so you can see git bash is now opened on my Windows operating system I can even go to my start menu and then click on all apps here and then under G I will be able to see get here and when you expand this git option you have this git bash git CMD and you also have git GUI so let me open git Bash from here and let me also open git GUI and let's see how it looks like so you can see there is this kit GUI and you can clone existing repositories here using git GUI open existing repository or create a new repository for now uh I'm going to use the command line tool so let me quit this GUI so now git is working right so let's create some kind of code and then we are going to commit our code so to do that let me open some kind of folder where I have a JavaScript file which I want to commit and then I want to push this JavaScript code to a GitHub repository right so this folder JS apps is on my desktop as you can see and then I have this test dot JS file here so what I am going to do is I'm going to right click here and I can either open terminal in this folder or I can click on show more options and I can click on get bash here so git fake bash is going to be opened inside this folder right so you can see I'm in my desktop and then JS apps folder right so the first thing you need to do here is we need to uh run a command called git init right it's going to initialize the git into this project so just write git init and then press enter which is going to initialize git into your project right and then when you do LS hyphen Al here you will see that there is this dot git uh directory which is created if you see it using folder Explorer you might not be able to see it because it's a hidden folder but on git bash you will be able to see it and now once the git is initialized we can check the git status so just write git status command here and you will see in the output it says untracked files and this is the untracked file I only had one file in my project folder which is test.js and git says that this file is not yet dragged using git right so we need to add this file to git and then commit this file right so to add this just write git add and the file name which is test.js and then press enter and it's going to add this file into git once again run get status command and now you will see this file in green so what this means is we have added the file to get but we need to commit this file also right so once you have added this file to get just write git comment here and then write hyphen M hyphen m is the flag which we use to give any comment right so I can give a comment to my commit for example first commit here and then the file name which is test dot TS and then press enter and once you press enter this file will be committed right now before committing this file you will be able to see uh this error you have to configure git before committing this file and you have to run these two commands right first one is git config user dot email and then second command is git config Global username and give your username right so I'm going to just do that so let me just copy and paste this command on the terminal which is the first command and you can replace the email sample email by your email here right so I can just write x y z for example at the rate gmail.com so I just want to give a sample email ID here you might want to give your real email ID in this case and the second command is git config hyphen hyphen Global user dot name so give the username here so I'm going to give the username you can give any username here and then press enter and once you are done you can once again run this git commit hyphen m first commit test dot JS in my case it can be any file in your case so let me run this command and this time it's going to be successful right so you can see our file is committed let me clear the terminal here and now I will write git status once again and then it says nothing to commit and our working tree is clean right so we have committed our code and you can also see that on git bash you will see the branch name in front of your folder name and right now the branch name is main here right and git has created this main default Branch for us so now we are done with the git part let's go to GitHub now so you can just search for GitHub and then click on the first link here and if you don't have the GitHub account you can create one very simply and once you are inside your GitHub account it's going to look like this right so in order to create a new repository you can click on this plus sign and then click on new repository and then give any name to your repository now what I will suggest is you can give the same name as your project name so in my case my project folder name is JS apps right so I can copy this name and then paste it as the repository name it's not necessary but what I generally do is I generally give the same name to my repository as my project name on my local system right and then you can add the description my first app for example so this will be the description of your Repository you can also add the readme file you can also add git ignore files and license files for now I don't want to do anything but you might want to add these files in your real projects right and then click on create Repository and our repository is created now right so now if you see closely here uh git Hub is going to give us some kind of procedure how you can push your code on this repository so if you see here we have already ran the git init command we have already ran the get add command to uh add the test.js file which was the file in our project right we have already ran the git commit command with hyphen M right we are already on the main branch right so you can see when I go to git uh bash terminal the branch name is highlighted here which is main right so first four command we have already uh done now the next command is git remote add or region this is the thing you need to do now right but before doing this I will recommend you to create a GitHub token because you will require wire a GitHub token in order to push your code into your repository so what I will recommend first is just go at the top here and then let me open this uh GitHub website on the next tab so just go at the top and then click on your profile and then click on settings here and once you are on settings just go at the very bottom on the left hand side where you will see developer settings I'm going to click on that and once I'm inside the developer settings I can click on personal access token here and then I'm going to create a classic token right so here I can click on generate new token and then I'm going to click on generate New Classic and I can give any name to my token so my first token for example and then you can also choose the expiration date for your token so I can choose the custom date and I want to expire this let's say after two days okay so today is 24th I will expire this token after two days because I am just creating this for the demonstration purposes in your case you might want to choose 90 days or even you can choose no expiration which means that your token will never expire so you can use it forever right and then just check all these check boxes here so so you are allowing the user if he uses this token create or delete your repository right into the packages uh and all the other privileges right so admin privileges I'm going to choose each and every uh option here for this token so let me just choose all these and once I'm done I can create this token so I'm going to click on generate token here and this token is generated now you need to keep in mind that this token you can only see once right once you close this window you will not be able to see it again so you it's a good idea to backup this token somewhere right so I will copy this token for now and let me open let's say notepad so let me open notepad and then paste this token here so that I can use this later okay so let's go to the repository where we were seeing these git commands and as I mentioned we have already finished first four commands so we can give this command and it says you can give this Command right but instead of giving this command you can give this command to use this token right so we have created this token right and instead of giving git remote ad the command is same git remote add or region right and then https and before github.com you can provide your token so that you don't need to provide any username and password at the time of git push right so just provide the token I'm going to give this command in the description of this video so you can directly copy this so I'm going to give this token and then give your username and the repository name you can see the username and repository name at the top in the URL also or you can also see it here right so this is the username and this is the repository name so let me copy these two things and then I'm going to replace this here so this is my command right https token name at the red github.com forward slash username and the repository name so the only change we need to do here is we need to provide the token name at the rate github.com okay so just uh copy this command and then paste it on the terminal and you need to paste it inside the same folder in which you are working so we are working inside the GS apps folder right so I'm going to paste this command here and there was some error because I copied some foreign characters here so I'm going to remove them and now I'm going to give this Command right which is git remote add origin https token name at the rate github.com so basically what this command is going to do is it's going to um add the remote origin for this project right which is our repository link okay and then you can give the next command which is git push hyphen new origin main okay so you can give this Command right click copy and then paste this here and then press enter which is going to push your code in to GitHub okay so if everything works correctly this branch is created and once you refresh this folder so let me open the next Tab and I will go to the repository once again because [Music] I want to just leave this as it is and then you can see we have created this JS apps repository right so I can click on this and you will see that our test dot JS file is here okay so inside the stash dot JS file I have some JavaScript code which is basically uh starting a very simple localhost web server right so our code is committed and it's there on GitHub right now if you want to change something in your code let's say I have this test dot TS file once again so you can see when I give LS I have this test.ts file and let me open this using code if you have Visual Studio code you can open this in Visual Studio code by just giving this command code space dot which is going to open this folder in Visual Studio code editor right and this is the code which we have committed right so in addition to a hello world let's say I will add some special characters here so now once you change your code you can commit this code once again right so in order to commit this code once again go to the same folder give get status command and you can see it will say you have some uncommitted code so just write git commit hyphen M and then your message so I can just say second commit here and then the name of the file which is test.ts and then press enter and every time you commit the code you need to push that also right so right now you can see the hello world look like this right so once we will commit the code we have changed the code little bit and we have added this these special characters after this hello world so we want to see this on the GitHub repository also right so what we are going to do is we are going to uh Commit This code so we have already committed this code with this comment which is second comment and now we are going to post this code in order to push this code you give this command git push hyphen U origin main okay press enter and then your code is pushed and once again when you will refresh this uh code or this URL so let me refresh this URL and hopefully this change will reflect in the GitHub also so you can see these special characters are added in my code in my test.js file right so this is how you can install and use git and GitHub on your windows 11 operating system I hope you enjoyed this video and I will see you in the next video
Info
Channel: ProgrammingKnowledge
Views: 186,279
Rating: undefined out of 5
Keywords: Ubuntu 18.04, Linux, GitHub Ubuntu, Ubuntu 20.04, Git (Software), GitHub (Website), Ubuntu (Operating System), Installation (Award-Winning Work), Repository, GNU/Linux (Operating System), Windows, Tutorial, Desktop, GitHub, git setup, git bash, git install, git package, setup git server, git clone, Ubuntu 22.04 LTS, Windows 11, Git, Windows11, Windows10, gittutorial
Id: AdzKzlp66sQ
Channel Id: undefined
Length: 24min 11sec (1451 seconds)
Published: Tue Jun 27 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.