# Git - config
# config files
# config files on windows systems
the order in which Git for Windows sources configuration information is as follows:
C:\ProgramData\Git\config
- system config (e.g.
C:\Program Files\Git\mingw64\etc\gitconfig
) - global config (
%HOMEPATH%\.gitconfig
) - local config (repository-specific
.git/config
)
# list config via CLI
$ git config --list
core.symlinks=false
core.autocrlf=true
core.fscache=true
color.diff=auto
color.status=auto
color.branch=auto
color.interactive=true
help.format=html
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
$ git config --list --show-origin
file:"C:\\ProgramData/Git/config" core.symlinks=false
file:"C:\\ProgramData/Git/config" core.autocrlf=true
file:"C:\\ProgramData/Git/config" core.fscache=true
file:"C:\\ProgramData/Git/config" color.diff=auto
file:"C:\\ProgramData/Git/config" color.status=auto
file:"C:\\ProgramData/Git/config" color.branch=auto
file:"C:\\ProgramData/Git/config" color.interactive=true
file:"C:\\ProgramData/Git/config" help.format=html
file:"C:\\ProgramData/Git/config" http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:"C:\\ProgramData/Git/config" diff.astextplain.textconv=astextplain
file:"C:\\ProgramData/Git/config" rebase.autosquash=true
file:"C:\\Program Files\\Git\\mingw64/etc/gitconfig" credential.helper=manager
file:C:/Users/robert/.gitconfig user.name=rob
file:C:/Users/robert/.gitconfig user.email=me@robert.tld
file:C:/Users/robert/.gitconfig core.autocrlf=false
file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=false
file:.git/config core.bare=false
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# list scoped config via CLI
$ git config --system --list --show-origin
file:"C:\\Program Files\\Git\\mingw64/etc/gitconfig" credential.helper=manager
1
2
2
$ git config --global --list --show-origin
file:C:/Users/robert/.gitconfig user.name=rob
file:C:/Users/robert/.gitconfig user.email=me@robert.tld
file:C:/Users/robert/.gitconfig core.autocrlf=false
1
2
3
4
2
3
4
$ git config --local --list --show-origin
file:.git/config core.repositoryformatversion=0
file:.git/config core.filemode=false
file:.git/config core.bare=false
1
2
3
4
2
3
4
# .gitattributes
file
For line endings management, check text option.
# changing config values via CLI
# pattern
git config <scope> <property> <value>
# example
git config --global user.name "Robert Duchmoul"
# excluding files
- Per Project:
.gitignore
file in the repository - Per Repository: in
.git/info/excludes
- Per Computer: through settings in
~/.gitconfig
# global .gitignore
Configure a global .gitignore
file applying to every project on the computer :
Create a gitignore file in your home dir, for ex ~/.gitignore_global
.
A possible content :
# Logs #
########
*.log
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
# IDE files #
#############
nbproject
.~lock.*
.buildpath
.idea
.project
.settings
composer.lock
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Others examples here and here.
Then add this file to the current config :
- inside
~/.gitconfig
:
[core]
excludesfile = /home/user/.gitignore_global
1
2
2
- or with CLI :
git config --global core.excludesfile ~/.gitignore_global
1