git : getting started with git

zakiarsyad profile image Zaki Arrozi Arsyad ・2 min read

Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.


Git is the most commonly used for version control. Git help us to makes collaboration easy. Even we work by our self, we will love it.

Git runs in our local machine. We also can use online host such as Github, Gitlab, and Bitbucket.

Installing git

We can easily download git from this Download page.
For MacOs, I prefer to use homebrew instead. Just simply type this command brew install git.

And in linux, I will do apt-get install git.

Run git in our terminal to check if it's successfully installed.

Connecting to github with SSH

There are two ways if we want to communicate with github.

First one is using HTTP, and the second one is using SSH. Actually we don't need anything else if we want to clone a github repository using HTTP, but we will need some configurations if we want to use SSH.

This example is explaining in linux machine, need a little adjustment if we run MacOs or Windows.

  • Generating a new SSH key

Run this terminal command to create a new SSH key

$ ssh-keygen -t rsa -b 4096 -C "our_email@example.com"

By default, the key will saved in this path ~/.ssh/id_rsa.pub

  • Adding the SSH key to our github account

Copy the id_rsa.pub file generated by previous command.

Go to our github account. Find Settings - SSH and GPGP keys - New SSH key.
Create a Title and paste our Key there, then hit Add SSH Key.

We can run this command to test if our key is successfully configured.

$ ssh -T git@github.com
Hi zakiarsyad! You've successfully authenticated, but GitHub does not provide shell access.

Setting our git username

# setting our username
$ git config --global user.name "zakiarsyad"

# confirm that we set userneame correctly
$ git config --global user.name

Setting our commit email address

# setting our username
$ git config --global user.email "zakiarsyad@mail.com"

# confirm that we set userneame correctly
$ git config --global user.email

git is ready to use in our local machine.

Posted on by:


Editor guide