Configure your Git repo

After installing Git and setting up our first repository, and efore starting our journey with Git, we need to do basic configurations.

  1. Email

in order to configure email ,use this command : git config user.email "email here"

If you are inside a Git repository, this will set the email only for this repository, in order to make that email global (for all Git repositories), you can use --global option, like this : git config --global user.email "email here"

  1. Username

in order to configure your username, you can use this command : git config user.name "name here"

Similarly to the email, you can set this username globally with --global option

  1. Text Editor

You can choose your preferred Git text editor, where you can edit text while merging and rebasing (we will see these notions later). This is especially useful if you are not familiar with Vim, the text editor that comes by default with Git.

In my case, I prefer to use Sublime Text 3, so the command I used was :

git config --global core.editor "'C:\Program Files\Sublime Text 3\subl.exe' -w"

  1. Storing credentials

You can use this command :

git config --global credential.helper store

This command will start a local store (think of it as a file) for you on your computer, in the next time you use git push (to push your commits to the server for example), Git will ask you for your credentials and then will store them in this file.

Beware that these credentials are stored on your file system as plain text, so it's up to you to decide whether you want to use this or not.

This is generally the configuration I use for my projects, hope this helps !

Happy learning !