Configuration

Configuration #

Text editor #

In some situations (commit without message, merge commit, etc.), git automatically opens a text editor to let you type a message.

By default, on most operating systems, git open vi for this purpose. I you have never used vi, we recommend selecting another text editor.

You can do this by running:

git config --global core.editor <myEditor>

where <myEditor> is the command that launches your text editor (for instance notepad for Notepad, open -e -W -n for TextEdit , gedit for gedit, sublime for Sublime Text, etc.)

Protocol #

Git hosting services (such as GitHub) usually support two alternative protocols for sharing content with a remote: https and ssh.

ssh is generally recommended.

SSH key #

To share content via ssh, you need a cryptographic key, often called an “ssh key” (in practice, this is an RSA key).

You may already have an ssh key on your machine. By default, ssh keys are located in the dot folder <homeFolder>/.ssh (or <homeFolder>\.ssh on Windows).

If this folder exists, then it should contain (at least) one file with extension .pub. Such a file contains a public RSA key. You can share this key with a git host for authentication.

If you do not have an SSH key on your machine, then you can generate one by running

ssh-keygen

in a terminal (Linux and macOS) or in the Windows Power Shell (Windows). If you accept the default location, this command will generate the .ssh folder and a key.

In order to add a public key to your GitHub account, log in to GitHub, select “Settings”, then “SSH and GPG keys”. Click on the “New SSH key” button, give a name to your key, and paste your public key (i.e.the content of the file with extension .pub) in the field “Key”.

For more details, you can for instance consult this page.

HTTPS credentials #

If you prefer, you can interact with (most) git hosting services via HTTPS. By default, this requires entering your credentials for each interaction with a remote.

To avoid this, you may consider caching your GitHub credentials in Git.