CLIs, or Command Line Interfaces, are extremely powerful when it comes to accessing the basic functions of your computer. In fact, there are some things you can only do from the command line, even on Windows. Beyond that, many programs just work better on the command line. Take Git, the most widely used modern version control system in the world today; Git was designed exclusively for the command line, and it is the only place you can run every available Git command. (Most GUIs only implement some subset of Git functionality for simplicity.)

In this tutorial, we will learn how to setup a Git/CLI environment on Windows.

Install Git on Windows

Visit the Git website and download the latest Git for Windows Installer (At the time of writing this article the latest version is 2.9.3.) This installer includes a command line version of Git as well as the GUI.

Once you started the installation, you will see an easy Setup Wizard where the only instruction you need to follow is to select Next and Finish buttons to complete the installation. There is no need to change the default options, the only thing I would like to highlight is that the default terminal emulator is MinTTY instead of Windows console. This is because the Windows console has some limitations. We’ll learn more about these limitations as we walk through the rest of this tutorial.

Now you are ready to start using git and run your first commands! Open Git Bash and type the following command to verify your installation:

Then enter git --help to see all the available commands.

Congratulations! You’ve just run your first git commands!

Using Git with PowerShell

Using Git in PowerShell
Thanks to our previous git installation, the git binaries path should be already set in your PATH environment variables. To check that git is available, open PowerShell and type git. If you get information related to git usage, git is ready.

If PowerShell doesn’t recognize the command, you’ll need to set your git binary and cmd path in your environment variables. Go to Control Panel > System > Advanced system settings and select Environment Variables.

In System Variables, find PATH and add a new entry pointing to your git binaries and cmd, in my case I have them in C:\Program Files\Git\bin and C:\Program Files\Git\cmd.

Beautify your PowerShell

If you click on ‘Properties’ right after clicking the small PowerShell icon in the top left corner, you will find several visual features to customize your console just the way you want.

In ‘Edit Options’ make sure to have ‘QuickEdit Mode’ checked. This feature will allow you to select text from anywhere in PowerShell and copy the selected text with a right-click, and paste it with another right-click.

You can explore the different tabs, select your preferred font and font size, and even set the opacity to make your console transparent if you are using PowerShell 5.

Now that you have a nice console with much-needed copy/paste functionality, you need something else to enhance your experience as a git user: you need Posh-Git.

Posh-Git is a package that provides powerful tab-completion facilities, as well as an enhanced prompt to help you stay on top of your repository status (file additions, modifications, and deletions).

Posh-git Installation

To install Posh-git let’s use what we have learned so far about git and PowerShell. Start by creating a folder ‘source’ using the mkdir command:

Change your working directory to ‘source’ and type clone command:

Verify that you are allowed to execute scripts in PowerShell by typing ‘Get-ExecutionPolicy’. The result should be RemoteSigned or Unrestricted. If you get a restricted result, run PowerShell as administrator and type this command:

Change your working directory to Posh-git and run the install command:

Reload your profile for the changes to take effect:

And you’re done!

You can make changes to files in your repository and explore Posh-git by typing git status.

Setup Your SSH Keys

Usually, you would use HTTPS protocol to communicate with the remote Git repository where you are pushing your code. This means that you must supply your credentials (username and password) every time you interact with the server.

If you want to avoid typing your credentials all the time, you can use SSH to communicate with the server instead. SSH stands for Secure Shell. It is a network protocol that ensures that the communication between the client and the server is secure by encrypting its contents.

SSH is based on public-key cryptography, so in order to authenticate via SSH to the Git repository you need to have a pair of keys: one public (which will reside on the server) and one private (the one you and only you will use to authenticate to the server). When you supply your private key to the server, it will verify it matches the installed public key, and if it does, then you will be authenticated.

To access your Git repositories you will need to create and install SSH keys. You can do this with OpenSSH which already comes installed with Git. To generate your key pair open Git Bash and enter the following command:

This will generate a key pair using RSA as the key type and will use 4096 bits for it. It will then prompt you to enter a location to save the key. If you press Enter, it will be saved in the default location.

Then you will be prompted to enter a passphrase. Type a secure one:

And that’s it! You have just created an SSH key pair. Easy, isn’t it? Now you have to add your SSH key to the ssh-agent. First of all, let’s make sure ssh-agent is installed by typing:

Then, add your SSH key to the ssh-agent:

You now have your private key installed on your computer, but you need to set the public key on the Git remote repository. This step depends on which Git hosting service you are using. There are tutorials available for both GitHub and BitBucket, the two most popular services.

Use Console Emulators for Improved CLI Experience

You may be asking yourself “Why should I use a console emulator on Windows instead of the native cmd?” The answer is simple: Console emulators let you choose which shell to run on them and provide you with a variety of configuration options, both for utility and aesthetics.

Most emulators also support multiple tabs. On each tab, you can run a different shell, or, if you work with multiple git repositories, you could configure multiple tabs pointing to your different working directories. There are emulators that can save the state of each, so when you open up your emulator again they will be there just as you left them.

Also, if you want to improve your productivity you can configure some hot-keys to speed up repetitive tasks or even use some very useful commands like cat or grep. There are several alternatives that offer lots of functionality and integrate very well with Windows. Let’s review some of them:


ConEmu allows you to run “console” applications such as cmd.exe, powershell.exe, Far Manager, bash, etc., and “graphical” applications like Notepad, PuTTY, KiTTY, GVim, Mintty and so on. Given that it is not a shell, it does not provide some standard shell features like remote access, tab-completion or command history.

You can pre-configure tabs, give them custom names as well as Shell scripts to run when they open, plus additional configuration options; nearly everything about ConEmu can be customized.

Also, you can search all the text that has been printed or entered in the console history, resize the main window as much as you want, and check the progress of an operation with a quick glance at the taskbar, without bringing the app to the foreground.

Installation is super easy: just unpack or install to any folder and run ConEmu.exe.


Cmder is an improved version of ConEmu. It combines all ConEmu features with cmd enhancements from clink (such as bash-style completion in cmd.exe and PowerTab in powershell.exe) and Git support from msysgit. Current branch name is shown on the prompt. This feature is built-in, so you don’t need to install any extension like we did for PowerShell.

With Cmder you can run basic unix commands like grep. Also, you can define aliases in a text file for common tasks or use the built-in aliases like .e which opens an Explorer window at your current location. Installation is easy: choose and download your preferred Cmder version (mini or full), unzip files and run Cmder.exe.



With Console2 you can not only create as many tabs as you want but also name them individually based on what is running on each. Also, you can assign a Shell script to each tab, automated to run on open.

You can even customize the keyboard shortcuts (like changing Open New Tab to Ctrl+T) and the appearance (like font, colors, and size).

Console2 does have some drawbacks. The first time I tried to configure a new tab, following the normal flow (settings > tabs > shell : git shell path), in order to point to git shell, the tab was opened in a separated window, outside of the Console2 context. It took me a while to find out how to configure Console2 to open the git shell as a new tab inside of its context. If you need a hand with this, you should check this link.

Also, it lacks the functionality to allow multiple tabs to automatically run predefined scripts. Instead, you have to open everything manually every time you start the application.


As a fork of Console2, ConsoleZ should look quite familiar, and it will recognize all of your Console2 custom settings. If you are already using Console2, you should give it a try.

Besides the Console2 features there are many more options in nearly all the Settings panels, like splitting Tabs into views (horizontally and vertically), settable opacity of text background color, snippets and zooming.

As with Console2, ConsoleZ is not able to open pre-created tabs on startup.


PowerCnd offers similar features to the others listed above, but it has other cool features, such as auto-log (which prevents you losing your work by saving the output of your consoles automatically), AutoCompletion for files under current directory and Bookmarks with the ability to move between them easily.

Also, you can save and restore your command line sessions from last time. This emulator isn’t free, but does offer a free trial so you can take it for a test drive.

Go Forth and Experiment

You have so many options and enough information to start with the command line. There are no excuses for not starting to play with it using a good emulator! So, choose your favorite one, clone your repository and continue running your git commands on the CLI.

Interested in learning more about git commands and CLI tools? Check out these resources:

  • Building Simple Command Line Interfaces in Python
  • Set Up a Smoking Git Shell on Windows
  • Git in Powershell