Chapter 2. Getting Started
In this chapter, you’ll get started working with Git by setting your defaults and preferences, and learn the basics of creating a repository and adding initial content to it.
Basic Configuration
Before starting in with Git, you’ll want to set a few basic parameters using git config. This command reads and changes Git configuration at the repository, personal, or system level. Your personal Git configuration is in ~/.gitconfig; this is a plain-text file, which you can edit directly as well, if you like. Its format is called INI style (after a file extension commonly used for it, though not by Git), and is divided into sections, like so:
[user]
name = Richard E. Silverman
[color]
ui = auto # overall default for color usage
[mergetool "ediff"]
trustExitCode = trueComments are introduced with a hash sign (#) as shown, as is common in Unix configuration files. The parameters have full names qualified by the section in which they appear using a dot; for example, the parameters mentioned in this example are:
-
user.name -
color.ui -
mergetool.ediff.trustExitCode
You use these names when reading or setting parameters with git config, rather than editing the file yourself. To set a parameter with git config:
$ git config --{local,global,system} parameter value
If you give this command when your current directory is inside a Git repository, it implies --local, and it will change the configuration for that repository only, in the file .git/config. Otherwise, the default ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access