Installation
Simple installation instructions for the most common operating systems.
- Download (opens in a new tab) and install git 2. Open the
terminal and run
git --versionto verify the installation
Configuration
Git config is a command-line tool used to manage Git settings. It allows you to set various options such as user name, email, default text editor, and more. Git config also lets you create aliases for frequently used commands and set configuration options at different levels (system, global, local). To use Git config, use the git config command followed by the option and argument you want to set or view.
New Configuration
-
Open a terminal or command prompt on your computer.
-
Navigate to the directory where you want to create a new Git repository.
-
Type "git init" to initialize a new Git repository in the current directory.
-
Type "git config" followed by the configuration option you want to set. For example, to set your name, type "git config --global user.name 'Your Name'".
-
Repeat step 4 for any other configuration options you want to set, such as your email address, default text editor, or merge strategy.
You can also edit the Git configuration file directly by typing git config --edit.
Existing Configuration
- Open the terminal and run
git config --list --show-originto see your existing configuration
Λλ> git config --list --show-origin
file:/Users/john/.config/git/config core.editor=nvim
file:/Users/john/.config/git/config init.defaultbranch=main
file:/Users/john/.config/git/config merge.conflictstyle=diff3
file:/Users/john/.config/git/config pull.rebase=false
file:/Users/john/.config/git/config user.name=John Doe
file:/Users/john/.config/git/config user.email=john@acme.com
file:/Users/john/.config/git/config user.signingkey=••••••••
file:/Users/john/.config/git/config gpg.program=gpg
file:/Users/john/.config/git/config commit.gpgsign=true
file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=true
file:.git/config core.bare=false
file:.git/config core.logallrefupdates=true
file:.git/config core.ignorecase=true
file:.git/config core.precomposeunicode=true
file:.git/config remote.origin.url=git@github.com:john/wiki.git
file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
file:.git/config branch.main.remote=origin
file:.git/config branch.main.merge=refs/heads/main