Configure Git on Windows

Francis Edward del Rosario
3 min readMay 11, 2022

This article assumes you have already created an account on GitHub and have Git installed. If you do not have an account, it is recommended you create one to be able to follow along this tutorial.

For Git to work properly, we need to let it know who the user is so that it can link a local Git user to GitHub

The following commands will configure Git:

git config — global user.name “Your Name”
git config — global user.email “yourname@example.com”

GitHub change the default branch on new repositories from master to main. Change the default branch for Git using the command:

git config — global init.defaultBranch main

Enable colorful output with Git by typing:

git config — global color.ui auto

Verify username and email using the commands:

git config — get user.name
git config — get user.email

Create an SSH key:

ssh-keygen -t ed25519 -C <yourename@example.com>

Link the generated SSH key to GitHub:

  1. Login to GitHub

2. Click on your profile picture in the top right corner then, click on Settings from the drop-down menu

3. Click SSH and GPG keys from the left-hand side

4. Click New SSH key

5. Copy and paste the content from the generated id_ed25519.pub key

Test your SSH connection by typing

ssh -T git@github.com

Excellent! We have configured Git and GitHub.

References:

https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup

--

--