DEV Community

Orinda Felix Ochieng
Orinda Felix Ochieng

Posted on

How to setup git on linux and windows

This is a guide towards setting up your git environment

Git

TLDR,

Assumptions for git theories

Where can you get git?

Depending on your os we'll handle them differently

Windows

To install git on windows head over to
Git source link

Download the given executable file for windows
Once downloaded,

double click on the .exe file and accept the licence agreements

For the rest of choices click next and leave every other setting as default

Once installed head over to your windows applications list

Search for git bash

Confirm if its installed properly

Open your cmd and type Users\uname> git --version

If there's no version you may reconsider re-installing the app again

Next we need to setup the git config
Git is now installed and we can now setup the configurations from any terminal eg

  • cmd
  • powershell
  • git bash
  • cmder

So open your terminal and type the following

$ git config --global user.name <username> # eg git config --global user.name "Jane Doe"
$ git config --global user.email <email-address> # eg git config --global user.email "janeDoe@gmail.com"
$ git config --global core.editor "code --wait"
$ git config --global core.autocrlf true

Enter fullscreen mode Exit fullscreen mode

Linux

I'm using debian distros i.e

  • kali linux
  • Ubuntu
  • zorin
  • Parrot

The git package is already available for you in the terminal
To confirm run $ git --version
If it does't exist run

$ sudo apt-get install git
Enter fullscreen mode Exit fullscreen mode

The command should install git to your system
Next we configure git

$ git config --global user.name <username> # eg git config --global user.name "Jane Doe"
$ git config --global user.email <email-address> # eg git config --global user.email "janeDoe@gmail.com"
$ git config --global core.editor "code --wait"
$ git config --global core.autocrlf input

Enter fullscreen mode Exit fullscreen mode

⚠️ Be careful

Make sure to consider the differences in the values of core.autocrlf for Windows and Linux difference

Now we have setup git and configured it to the system
To check your settings run

$ git config --list
Enter fullscreen mode Exit fullscreen mode

Well done

Success

We've successfully setup git in our system

Top comments (0)