avatarValentin Despa

Free AI web copilot to create summaries, insights and extended knowledge, download it at here

3199

Abstract

l use <code>master</code> as their primary branch. There is a movement to replace master with main, but Git still uses master as a default.</p><p id="27e6">Major Git hosting companies (such as GitHub and GitLab) have already renamed their default branch name from <code>master</code> to <code>main</code>.</p><p id="d142">Currently, Git still used master as a default. However, I highly recommend overriding this setting, as shown in the image below.</p><figure id="2ae8"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*3qdknbhi7b-wBul_wyuSaQ.png"><figcaption></figcaption></figure><h2 id="efae">PATH environment</h2><p id="0a2d">Whenever you wish to use a tool from a command line without specifying the full location path, you need to tell Windows about this by adding that directory to the PATH environment variable. Git is no different. I recommend using the default option.</p><figure id="e667"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*QzIeflsfGvqEn8zK9NR1gg.png"><figcaption></figcaption></figure><h2 id="759e">SSH executable</h2><p id="a4fc">Unless you know that you have OpenSSH already installed, it is best to use the OpenSSH that comes with Git.</p><figure id="796e"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*fyVHEc8d8rEid9QCLlJgAw.png"><figcaption></figcaption></figure><h2 id="260f">HTTPS transport backend</h2><p id="3fec">Unless you have specific instructions, use the OpenSSL library. In case you later face issues cloning private repositories from within your organization due to certificate validation issues, you may want to come back to this section.</p><figure id="4fb3"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*TmVAsLzuFajDRBVx0GbRAg.png"><figcaption></figcaption></figure><h2 id="60d4">Line ending conventions</h2><p id="96f9">Windows and Unix systems use a different encoding for line endings. Unless you have other instructions, it is best to go with the default here.</p><figure id="2e0d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ytpj3ypqxcb0-chgRDsVHA.png"><figcaption></figcaption></figure><h2 id="b90f">Terminal emulator for Git Bash</h2><p id="68e9">The MinTTY terminal emulator is much more modern and for most use-cases the best choice.</p><figure id="4994"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*GVKyMZuLb4A81KjQ_6EHIg.png"><figcaption></figcaption></figure><h2 id="fe84">Git pull behavior</h2><p id="0398">By default, pulling new changes from a remote Git repository does not attempt a rebase. Since most Git manuals and tutorials assume you use the default option, it is best to leave it as it is (for now).</p><figure id="eff7"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*VCNITZvcprMhKzqF5ikQcQ.png"><figcaption></figcaption></figure><h2 id="f045">Git credential helper</h2><p id="c834">Using a credentials helper is a great way to use multi-factor HTTPS authentication with Git. This is great for working with external Git repositories if you are working over HTTPS (and not SSH).</p><p id="2b59">To quote the documentation, the <a href="https://github.com/GitCredentialManager/git-credential-man

Options

ager/">Git Credential Manager</a> “provides multi-factor authentication support for Azure DevOps, Azure DevOps Server (formerly Team Foundation Server), GitHub, Bitbucket, and GitLab.”</p><figure id="c456"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*ZOtHRflUyAYD9mwQAwUuXQ.png"><figcaption></figcaption></figure><h2 id="dc59">Extra options</h2><p id="1955">This is way to technical, so we will go with the defaults.</p><figure id="633f"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*wyvLy7r30n5SN7_QObZCmg.png"><figcaption></figcaption></figure><h2 id="79f6">Experimental options</h2><p id="47c7">At this point, I don’t recommend enabling any of the experimental features.</p><figure id="f647"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*D3Sjpblch1FL770qtP7EyQ.png"><figcaption></figcaption></figure><h2 id="4681">Installation process</h2><p id="8ae1">This should not take more than one minute to complete.</p><figure id="e539"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*1XpjBx2z5w6SnbQVSVa06A.png"><figcaption></figcaption></figure><p id="b01e">This wizard has also installed a new tool called <b>Git Bash</b>, a terminal alternative for Cmd or Powershell. I will use it to demonstrate the upcoming steps.</p><figure id="3b33"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*r61sc3k0PZZjNwRuxa9NKg.png"><figcaption>Click on the checkbox to launch Git Bash and click on Finish.</figcaption></figure><p id="4ea6">From Git Bash or your terminal of choice, run the following command.</p><div id="2d94"><pre>git <span class="hljs-comment">--version</span></pre></div><figure id="ae8d"><img src="https://cdn-images-1.readmedium.com/v2/resize:fit:800/1*Zr04ZXxxSBwjlpF9p2gvlQ.png"><figcaption>The current Git version should be displayed</figcaption></figure><h1 id="358f">Step 2 — Configure Git</h1><p id="4c8c">Before we move forward, adapt the following commands with your name and email. They will be part of any changes you make to any Git repository. Do it now, otherwise, your work colleagues will give you a minus point.</p><div id="c93c"><pre>git config <span class="hljs-attr">--global</span> user<span class="hljs-selector-class">.name</span> <span class="hljs-string">"Your Name"</span></pre></div><div id="92a5"><pre>git config — <span class="hljs-keyword">global</span> user.email “you<span class="hljs-symbol">@example</span>.com”</pre></div><h1 id="87c4">Conclusion</h1><p id="240f">I hope this tutorial helped you get started with configuring your Git installation in Windows 10 to work with GitLab CI. Leave a comment in the section below if you have any questions. I would love to hear from you!</p><p id="cf74"><b>Thank you for sticking with this article until the end. If you enjoyed it, please leave a comment, share, and press that 👏 a few times (up to 50 times). It will help others discover this information and maybe it will help someone else as well.</b></p><p id="3d08"><b>Follow me on Medium and <a href="https://www.youtube.com/channel/UCUUl_HXJjU--iYjUkIgEcTw?view_as=subscriber">YouTube</a> if you’re interested in more tutorials like this one.</b></p></article></body>

[2022] How to install Git on Windows 10 / 11 (step by step guide)

If you want to be able to collaborate on Git projects from your own computer, you need to have Git installed. It’s not hard. Let me guide you through the process.

Latest update: May 2022

Step 1 — Install Git

Open any terminal and check if you already have Git installed by typing:

git --version

If you are getting back an error message, you need to install Git. I would anyway recommend installing/updating Git anyway.

Git is not present on the system yet.

Go ahead and open https://git-scm.com/. The latest version I see is 2.30.0.

Now open the installer you have downloaded and go through the installation process. Unless you know what you are doing, leave all settings to their defaults.

License Information

You need to accept the GNU GPL open source license to continue.

Select Destination Location

Unless otherwise instructed by your system administrator, use the installation path suggested by Git.

Select Components

Apart from the pre-selected options, you may also want to select “Add a Git Bash Profile to Windows Terminal”. This can be useful later on, especially if you plan to use Visual Studio Code or other IDEs that have a built-in terminal window.

Start Menu Folder

At this step, you can select the name of the start menu folder. The default value is Git. Right below, you have the option of not creating such an entry.

The default editor used by Git

Sometimes Git will ask you to insert or edit some text, for example, when entering a commit message. The default editor used is Vim. However, if you are a beginner and have never used Vim before, I highly recommend selecting another text editor you are familiar with, such as Nodepad++, Visual Studio Code, or the good ol’ Notepad.

The initial branch name

The entire software development community is trying to be more inclusive. Most Git repositories still use master as their primary branch. There is a movement to replace master with main, but Git still uses master as a default.

Major Git hosting companies (such as GitHub and GitLab) have already renamed their default branch name from master to main.

Currently, Git still used master as a default. However, I highly recommend overriding this setting, as shown in the image below.

PATH environment

Whenever you wish to use a tool from a command line without specifying the full location path, you need to tell Windows about this by adding that directory to the PATH environment variable. Git is no different. I recommend using the default option.

SSH executable

Unless you know that you have OpenSSH already installed, it is best to use the OpenSSH that comes with Git.

HTTPS transport backend

Unless you have specific instructions, use the OpenSSL library. In case you later face issues cloning private repositories from within your organization due to certificate validation issues, you may want to come back to this section.

Line ending conventions

Windows and Unix systems use a different encoding for line endings. Unless you have other instructions, it is best to go with the default here.

Terminal emulator for Git Bash

The MinTTY terminal emulator is much more modern and for most use-cases the best choice.

Git pull behavior

By default, pulling new changes from a remote Git repository does not attempt a rebase. Since most Git manuals and tutorials assume you use the default option, it is best to leave it as it is (for now).

Git credential helper

Using a credentials helper is a great way to use multi-factor HTTPS authentication with Git. This is great for working with external Git repositories if you are working over HTTPS (and not SSH).

To quote the documentation, the Git Credential Manager “provides multi-factor authentication support for Azure DevOps, Azure DevOps Server (formerly Team Foundation Server), GitHub, Bitbucket, and GitLab.”

Extra options

This is way to technical, so we will go with the defaults.

Experimental options

At this point, I don’t recommend enabling any of the experimental features.

Installation process

This should not take more than one minute to complete.

This wizard has also installed a new tool called Git Bash, a terminal alternative for Cmd or Powershell. I will use it to demonstrate the upcoming steps.

Click on the checkbox to launch Git Bash and click on Finish.

From Git Bash or your terminal of choice, run the following command.

git --version
The current Git version should be displayed

Step 2 — Configure Git

Before we move forward, adapt the following commands with your name and email. They will be part of any changes you make to any Git repository. Do it now, otherwise, your work colleagues will give you a minus point.

git config --global user.name "Your Name"
git config — global user.email “you@example.com”

Conclusion

I hope this tutorial helped you get started with configuring your Git installation in Windows 10 to work with GitLab CI. Leave a comment in the section below if you have any questions. I would love to hear from you!

Thank you for sticking with this article until the end. If you enjoyed it, please leave a comment, share, and press that 👏 a few times (up to 50 times). It will help others discover this information and maybe it will help someone else as well.

Follow me on Medium and YouTube if you’re interested in more tutorials like this one.

Git
Windows
Recommended from ReadMedium