User Tools

Site Tools


This is an old revision of the document!

Set up git

Setting up git is pretty straight-forward. Git configuration can be done per repository -local configuration-, per user -global configuration- and per host -system configuration-. Local configuration is stored in the repository at .git/config, global configuration at ~/.gitconfig and system configuration at /etc/gitconfig (depends on your distro). In the examples below we'll assume you are setting up git for your user, so we'll set up the global configuration.

Your identity

Let's begin by telling git your name and e-mail address. This will be used on commit logs and when sending e-mails through git send-email.

$ git config --global "John Doe"
$ git config --global

Optionally you may also add your PGP key fingerprint, this is useful if you maintain your own tree and want to guarantee its integrity. For more information on this, check out the kernel maintainer's pgp guide

$ git config --global user.signingKey <key fingerprint / key id>

Your mail settings

These settings are used for sending patches and patchsets through email

SMTP server configuration

These settings are used by git send-email, this is the most common way of sending patches, you may contact the SMTP server directly or through a local MTA. Note that you may also store your password here but it's not a good idea since it will be stored in plaintext. So leave it unset and git send-email will ask you for it. If you use Gmail you may use an app-specific password.

$ git config --global sendemail.smtpencryption tls
$ git config --global sendemail.smtpserver
$ git config --global sendemail.smtpuser
$ git config --global sendemail.smtppass myPass (DANGEROUS)
$ git config --global sendemail.smtpserverport 587

IMAP server settings

These settings are used by git imap-send when instead of an SMTP server, where an IMAP server or a local IMAP folder is used. This approach is not that common and the invocation of git imap-send won't be covered here, you may check out its man page for more infos.

$ git config --global imap.folder INBOX.Drafts
$ git config --global imaps://
$ git config --global imap.user
$ git config --global imap.pass myPass (DANGEROUS)
$ git config --global imap.port 993

Your preferences

Git allows you to use your favourite tools, in this example we'll use more for pager, nano for editor and meld for diff/merge. In order to use meld instead of the pager for displaying d

$ git config --global core.pager "more"

$ git config --global core.editor "nano -w"

$ git config --global diff.tool meld
$ git config --global difftool.prompt false

$ git config --global merge.tool meld
$ git config --global mergetool.prompt false
developers/env_prepare.1540211936.txt.gz · Last modified: 2018/10/22 15:38 by mick