Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does [core] in .gitconfig do, and how to set it up?

Tags:

git

git-config

I wish to know what does [core] do, and how to set it up in general. I found the .gitconfig file in my home directory to be this:

[core]
        autocrlf = input
        safecrlf = true

[user]
        name =  
        email = 

In another home directory, it looks like this:

[user]
        name =
        email = 
[core]
        excludesfile = /Users/chenfl84/.gitignore_global
[difftool "sourcetree"]
        cmd = opendiff \"$LOCAL\" \"$REMOTE\"
        path =
[mergetool "sourcetree"]
        cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
        trustExitCode = true
like image 838
Pippi Avatar asked Mar 03 '13 16:03

Pippi


People also ask

What is core git?

The git-core package is a "dummy" package, which has the git package as dependency. This is because the git-core package has been renamed to git . The dummy git-core package should be safely removable. In previous releases, it seems git was a virtual package for gnuit (GNU Interactive Tools).

What is git command to set configuration option?

The git config command is a convenience function that is used to set Git configuration values on a global or local project level. These configuration levels correspond to . gitconfig text files. Executing git config will modify a configuration text file.

What is git config core Autocrlf?

The git config core. autocrlf command is used to change how Git handles line endings. It takes a single argument. On macOS, you simply pass input to the configuration. For example: $ git config --global core.autocrlf input # Configure Git to ensure line endings in files you checkout are correct for macOS.

How do I change Gitconfig?

How to do a git config global edit? The global git config is simply a text file, so it can be edited with whatever text editor you choose. Open, edit global git config, save and close, and the changes will take effect the next time you issue a git command. It's that easy.


2 Answers

See the git-config(1) man page, or run git help config for general information on how Git configuration is arranged.

The [core] section refers to things that control the “core” of Git’s behavior: how files & updates are recognized, caching, compression, etc., etc.

The defaults are usually—just about always—what you want, but since many people do want to customize the *crlf options, they have been made explicit and put in a place convenient for changing.

like image 71
J. C. Salomon Avatar answered Sep 21 '22 19:09

J. C. Salomon


Each [section] begins a section that contains values. You could edit the file manually, or use git config, e.g.

git config --global core.name Pippi  # < value
#            section ^     ^ key

git help config has a list of options.

like image 22
Ry- Avatar answered Sep 23 '22 19:09

Ry-