Git Remote Servers and Git Initial Configuration

This is the followed up post about Getting Started with Git and Git Fundamentals and Unstaging a File posts that I previously written. I assume that you have Git already installed on your machine and know how Git repository works. If not, I recommend you to read the two posts described above. In this post, I will guide you through how to set up Git initial configuration for the first time.

Work Remotely with Git Repository

From now on, we will start using remote servers as a contact point for different developers. GitHub and BitBucket are the most commonly used repository remote servers. GitHub offers free space for open source repository that can be access anywhere in the world. In BitBucket, you can create private repository even in free personal account. So, we should not keep our sensitive information, such as passwords, in public repositories.

Logically, a git remote is another computer that has the same repository you have on your computer.

Setting up a new GitHub account

Sign up a new GitHub account using your e-mail at Once you are done, we can instantly create our brand new repository where we can push our code. In order to create a new repository, go to Repositories tab and click on the green New button. You will be redirected to the Create a New Repository page and enter a name for your repository.

I will name my new repository angular2-seed because I intend to use this repository as my Angular 2 application skeleton project with personalised features what I prefer.

Create a new repository in GitHub

The Description is optional but it allows people to better understand about your project is intended for. Then check Initialize this repository with a README to add a README file by making first commit by GitHub.

Setting up a new BitBucket account

The signup process is similar to GitHub and you can start using Bitbucket after registering with email at In the Repositories tab, click on the Create repository to create a new one. Fill the the name for the repository in the Create a New Repository page and click Create repository.

I will give the same name as above in GitHub, angular2-seed and choose Git in the repository type as we are going to work with git.

Create a new repository in Bitbucket

Git Initial Configuration

Before start making some configuration, let's take a look where Git configuration variables are stored.

  • /etc/gitconfig file stores values for every user on the system and all their repositories. When you use git config command with --system option, it works with this file specifically.

  • ~/.gitconfig file relates with specific user and Git read and write this file specifically when you use --global option.

  • config file in the .git directory located in every repository specifies to that repository. The values in this level can override values in the previous levels.

Configure Your Identity First

This is the first thing you should do after installing Git on your machine because every Git commit uses this information. To configure your identity: username and e-mail address, type the following commands replacing with your username and e-mail.

$ git config --global “John Doe” 
$ git config --global “” 

You only need to do this once because it configures with --global, which means Git will always use that information for anything you do on that system. If you want to change username or e-mail for specific projects, just run again those commands without --global options inside your working repository folder.

Choose Your Editor

Git use the system's default editor such as Vi or Vim. If you want to use a different text editor like Emacs, type the following command.

$ git config --global core.editor emacs

But I always stick with the default editor.

Set Diff Tool

When Git occurs conflicts in merge, it will ask you for what diff tool will be used. So, it is better we predefined the default diff tool like vimdiff first.

$ git config --global merge.tool vimdiff

You can also set other available diff tools that Git accepts such as kdiff3, tkdiff, and meld, etc.

Check Your Settings

This would be enough for initial configuration for start using Git. If you doubt about settings that you made previously, you can use git config --list command to list all the Git settings.

$ git config --list

You can also check for each specific key's value by typing git config {key}.

Nay Win Myint

A JavaScript full-stack web developer, also interested in Android application development and Graphic design.

United Kingdom