How to Install and Use Git on Windows 11

How to Install and Use Git on Windows 11.

Git is among the hottest model management programs, permitting you to maintain observe of all of the modifications made to information in order that, when required, you may simply revert to an earlier model. Git lets you’ve each an area repository and a distant one, encouraging collaboration by others and bringing all these modifications to a single supply. 

There are a number of methods you may set up Git on Windows 11. Here’s all the things it’s good to learn about it.

Prerequisites to put in Git on Windows 11

Before we start, there are a number of stipulations to putting in Git on Windows. Here they’re:

  • Administrator privileges on your Windows account
  • Access to a command-line instrument (corresponding to CMD or EnergyShell)
  • Username and password for Git (optionally available)
  • Your favourite textual content editor
  • Ubuntu on WSL (in case you’re putting in on it)

: How to Create a Restore Point in Windows 11

How to put in Git on Windows 11

Since there are a number of methods to put in Git, we are going to have a look at the strategies one after the other so you may see the steps to put in Git for all of the completely different strategies.

Method 1: Install Git from the Git official web page

Now, let’s check out how to put in Git the standard means. Here’s how to go about it:

Step 1: Download Git

The first step is to get the Git setup file. To achieve this, click on on the next hyperlink:

Download: Git Official web page

On the downloads web page, click on on Windows to get the newest setup file.

Step 2: Run Git setup

Now, navigate to the downloaded setup file and double-click to run the installer. Click Next.

Keep the default set up location, and click on Next.

On the subsequent display, you’ll have the ability to choose which elements you need to set up. Unless it’s good to change one thing particularly, we advocate holding the choices set to default. Then click on Next.

Click Next once more.

On the subsequent display, you’ll have to decide on the default editor for Git. Click on the drop-down menu to take action.

Then choose your textual content editor. We are going with Notepad++.

Click Next.

On the subsequent display, you’ll have the choice to decide on a unique identify for the preliminary department in new repositories. The default identify is ‘master’. Keep it that means until you need a completely different one, and click on Next.

The next step provides the PATH setting for Git when operating instructions from command-line purposes (corresponding to CMD and EnergyShell). Keep it set to default, and click on Next.

Now, select the Secure Shell consumer program for Git to make use of. As the installer comes bundled with the OpenSSH, there aren’t any modifications required right here (until you need to use an exterior OpenSSH). Click Next.

When selecting server certificates, we advocate using the default OpenSSL library. Click Next.

This part allows you to configure line-ending conversations. Leave it as set to default, then click on Next.

Now select your terminal emulator. Again, we’d advocate sticking with the default MinTTY. Click Next.

Keep the default habits of the command git pull. As earlier than, in case you don’t need to change its habits, the default possibility is advisable. Click Next.

Now, it’s important to select a credential helper that can assist get and save credentials. The Git Credential Manager core (default choice) is essentially the most steady one of many lot, so simply click on Next.

There are a number of extras to configure as nicely. The first possibility (chosen by default) is to “Enable file system caching”. This is necessary for sure features and in addition provides a big efficiency enhance. The different possibility is to “Enable symbolic links” that are much like command-line shortcuts. Select it in case you use them, or go away or not it’s in case you don’t. Then click on Next.

The previous couple of choices you get are “support for pseudo consoles” and a “built-in file system monitor”. These are experimental options which might be being actively developed. So, until you need to strive them out, we advocate leaving them unchecked. Then, lastly, click on on Install.

Once the set up is full, click on Finish.

: All the Windows 11 Shortcuts

Step 3: Check Git model

Once you’ve put in Git, it’s time to test if Git is put in correctly and its model. To do that, launch the Git Bash from the Start menu.

Then sort the next command and hit enter:

git --version

You ought to see the git model put in in your PC.

Step 4: Configure Git with username and electronic mail

To begin using Git on Windows 11, it’s good to configure it by coming into your credentials. Here is how you are able to do so:

Open Git Bash, then sort the next so as to add your consumer identify:

git config --global consumer.identify "your user name"

Make positive to interchange “your user name” together with your precise username. Then press Enter.

Now sort the next command:

git config --global consumer.electronic mail "your email address"

Again, be certain to interchange “your email address” together with your precise electronic mail deal with related together with your Git account. Then press Enter.

Now, if you wish to test the configuration, sort the next:

git config --global --list

Then press Enter.

You will see your configuration particulars.

Note: The --global command tells Git to make use of the knowledge you supplied for all that you just do in your system. If you employ --local as an alternative, the configuration will solely apply to your present repository.  

: How to Change a Wallpaper on Windows 11

Method 2: Install GitHub Desktop for Windows 11

If you’re trying to get a GUI-aided utility to handle your Git repositories and have others collaborate on it, GitHub Desktop is your buddy. Its set up can also be a quite simple course of. 

Download: GitHub Desktop

Go to the above hyperlink and click on on Download for Windows (64-bit)

Then run the downloaded setup. The setup gained’t require any modifications and set up GitHub robotically. Upon launch, you’ve the choice to check in to GitHub.com. Or you may go forward and Skip this step.

Type in your username and electronic mail. Then click on Finish.

And that’s it! GitHub Desktop is now prepared to make use of.

: How to Install PIP on Windows 11

Method 3: Use Git with EnergyShell

There’s a typical false impression that Git solely works nicely with Git Bash when actually it really works simply as properly on EnergyShell too. But there’s slightly addition that it’s important to make to EnergyShell earlier than that may be carried out.

Step 1: Check for Execution Policy

First up, it’s good to have the EnergyShell ExecutionPolicy set to “RemoteSigned”. So press Start, sort powershell, and click on on Run as administrator.

Now sort the next command in EnergyShell:

Get-ExecutionPolicy

Press Enter.

If you obtain the “RemoteSigned” message, then it’s already set.

If not, then sort the next command:

Set-ExecutionPolicy -Scope PresentUser -ExecutionPolicy RemoteSigned -Force

Then press Enter.

Now you’re prepared to put in the git module in EnergyShell. 

Step 2: Add the Posh-git module

To add the Posh-git module, sort the next command:

Install-Module posh-git -Scope PresentUser -Force

Then press Enter.

Next, we’re going to import the module into EnergyShell. To do that, sort the next command:

Import-Module posh-git

Press Enter.

You might need to guarantee that the module hundreds as default. For this, sort the next command:

Add-PoshGitToProfile -AllHosts

Press Enter.

You are actually prepared to make use of EnergyShell on your git expertise everytime you’re in a listing with a git repository.  

Method 4: Install Git on Ubuntu WSL

If you’ve put in Ubuntu on Windows Subsystem for Linux (WSL), it’s also possible to set up Git on it. Here’s how to go about it.

Open the Ubuntu App.

Then sort the next command:

sudo add-apt-repository ppa:git-core/ppa

Press Enter. 

Then enter your password and press Enter.

Press Enter to proceed including the git repository.

Now sort the next command to update it.

sudo apt-get update

Press Enter.

Now sort the next to put in git:

sudo apt-get set up git

Press Enter.

When requested to verify, sort Y and press Enter.

You have now put in Git on Ubuntu WSL.

Method 5: Install Git using the Winget instrument

There is a little-known instrument on Windows 11 known as the winget command line instrument that allows you to discover, set up, configure, and take away apps in your system. It can be utilized to put in Git on Windows as nicely.

On Windows 11, the winget instrument would already be put in so there’s no want to put in it individually. Here’s how to make use of it to put in Git on Windows:

Press Start, sort powershell, then right-click the best-matched end result and choose Run as administrator.

Then sort the next command:

winget set up --id Git.Git -e --source winget

Press Enter.

Wait for git to be downloaded and put in.

Once completed, you will note the message “Successfully installed”.

How to make use of Git on Windows 11

Now that we have now appeared on the numerous means of putting in Git on Windows 11, let’s now see how to go about using Git. Here are some things that you just may need to learn to do with Git:

1. Create and initialize an area check listing

To create a brand new native check listing, enter the next in Git Bash or EnergyShell:

mkdir check

Hit Enter. If you have already got a GitHub repository, sort the identify of the venture as an alternative of check.

Then, to vary listing, sort the next:

cd check

Hit Enter. Now, to initialize the git within the new listing, sort the next:

git init

Hit Enter.

If you need to add a number of venture information, you may merely enter the total identify of the venture file. For instance, if you wish to create a textual content doc, you’ll sort the next:

notepad check.txt

Hit Enter. This will open the mentioned app. 

Add the related content material. Then save the file.

You can observe your file by the next command and hitting Enter:

git standing

Here, you’ll see that Git acknowledges our information however hasn’t discovered any commits (or saves) to the file as talked about within the message – “No commits yet” and “Untracked files”.

2. Create a brand new distant repository

Firstly, go to github.com and check in. Then click on on the ‘+’ icon in direction of the highest proper nook. 

Select New repository.

Here, enter a reputation on your repository below “Repository name”. If it’s accessible, you’ll get a inexperienced tick.

Give your repository an outline (optionally available) and choose from Public or Private.

Then click on on Create repository on the backside.

Your repository is now created. Here, copy the HTTPS URL of your repository. 

3. Use Git commit command to avoid wasting modifications

As you’re working with Git, you may commit your modifications to offer a checkpoint on your work at any level. Think of it as saving your work alongside the way in which so to look back on these commit checkpoints and see the place the modifications to a code first appeared.

But earlier than committing a change, it first must be staged. Staging merely means you’re getting ready to commit the file(s). For our instance, we’re staging to commit the check.txt file. Here’s the command for it:

git add check.txt

Hit Enter. For a number of information, sort the next:

git add --all

Now, to commit the modifications, sort the next command:

git commit -m "commit message"

Replace the phrases inside the citation marks with a brief commit message of your individual. Then hit Enter.

4. Push native information to a distant repository

Now, let’s think about pushing these native information to a distant repository, just like the one created earlier.

The native information in your system in themselves work as a ‘clone’ for those that sit in your distant repository. All we have now to do is swap the origin of those information to your distant repository. For this, comply with the steps under:

Login to your GitHub account and go to your repository and replica the repository URL.

Then swap to Git Bash. Then sort the next:

git department -M most important

Hit Enter.

Then sort this:

git distant add origin repository_url

Replace repository_url by the one copied earlier.

Then hit Enter

Not sort this:

git push -u origin most important

Hit Enter. And identical to that, your native information are actually in your repository on-line which is able to now turn into its most important supply.

5. How to clone a GitHub repository

Cloning a GitHub repository is kind of easy. Go to your distant repository and replica its URL.

Once you’ve copied the URL of your repository, return to your Git Bash or EnergyShell window. Then sort the next command:

git clone "repository-url"

Replace repository-url with the copied URL of the repository. Then hit Enter.

And that’s about it!

Frequently Asked Questions (FAQs)

Installing git to handle utility variations and collaborating with others generally is a little difficult for newcomers and it’s pure to have questions on it. Here we deal with a number of generally requested queries that customers usually have when putting in git on Windows 11.

Can I exploit git in cmd?

When you put in the Git GUI, you additionally set up Git Bash and Git CMD. The latter is a command-line instrument that’s precisely just like the Windows console however higher in any respect issues to Git.    

What is the distinction between native and distant git repositories?

Git repos (quick for repositories) are available in two sorts – native and distant. In easiest phrases, the native git repository is the one that you just create and handle regionally, that’s, in your laptop alone. Its options and features are precisely like every other git repository. 

On the opposite hand, the aim of a distant repository (corresponding to GitHub) is to share your individual codes and information with the world, permitting others to department, merge, rebase, and so on.  

Does putting in GitHub set up Git?

Yes, in case you don’t have already got git, GitHub will set up git’s latest model as nicely. 

We hope you have been capable of simply set up git in your Windows 11 PC. 


Check out more article on – How-To tutorial and latest highlights on – Technical News