Git config variables can be stored in 3 different levels. Each level overrides values in the previous level. --global use global config file --system use system config file --local use repository config file - - - - - - - - - - (base) CMD> git config usage: git config [<options>] Config file location --global use global config file --system use system config file --local use repository config file --worktree use per-worktree config file -f, --file <file> use given config file --blob <blob-id> read config from given blob object Action --get get value: name [value-regex] --get-all get all values: key [value-regex] --get-regexp get values for regexp: name-regex [value-regex] --get-urlmatch get value specific for the URL: section[.var] URL --replace-all replace all matching variables: name value [value_regex] --add add a new variable: name value --unset remove a variable: name [value-regex] --unset-all remove all matches: name [value-regex] --rename-section rename section: old-name new-name --remove-section remove a section: name -l, --list list all -e, --edit open an editor --get-color find the color configured: slot [default] --get-colorbool find the color setting: slot [stdout-is-tty] Type -t, --type <> value is given this type --bool value is "true" or "false" --int value is decimal number --bool-or-int value is --bool or --int --path value is a path (file or directory name) --expiry-date value is an expiry date Other -z, --null terminate values with NUL byte --name-only show variable names only --includes respect include directives on lookup --show-origin show origin of config (file, standard input, blob, command line) --show-scope show scope of config (worktree, local, global, system, command) --default <value> with --get, use default value when missing entry - - - - - - - - - - (base) CMD> git config --list http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt http.sslbackend=openssl diff.astextplain.textconv=astextplain filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process filter.lfs.required=true credential.helper=manager add.interactive.usebuiltin=true core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait core.autocrlf=true core.fscache=true core.symlinks=true pull.rebase=false user.email=ashishjain1547@gmail.com filter.lfs.required=true filter.lfs.clean=git-lfs clean -- %f filter.lfs.smudge=git-lfs smudge -- %f filter.lfs.process=git-lfs filter-process* - - - - - - - - - - (base) C:\Users\Ashish Jain\OneDrive\Desktop>git config --get user.email ashishjain1547@gmail.com If a variable is not set, it returns empty line and fails silently. (base) C:\Users\Ashish Jain\OneDrive\Desktop>git config --get user.name (base) C:\Users\Ashish Jain\OneDrive\Desktop> - - - - - - - - - -Check Global Configurations:
(base) C:\Users\Ashish Jain>cd C:\Users\Ashish Jain (base) C:\Users\Ashish Jain>dir .gitconfig Volume in drive C is Windows Volume Serial Number is 8139-90C0 Directory of C:\Users\Ashish Jain 05/03/2021 09:52 PM 167 .gitconfig 1 File(s) 167 bytes 0 Dir(s) 66,402,430,976 bytes free ~~~ (base) C:\Users\Ashish Jain>type .gitconfig [user] email = ashishjain1547@gmail.com [filter "lfs"] required = true clean = git-lfs clean -- %f smudge = git-lfs smudge -- %f process = git-lfs filter-process - - - - - - - - - -How to view all settings?
Run git config --list, showing system, global, and (if inside a repository) local configs Run git config --list --show-origin, also shows the origin file of each config item (base) C:\Users\Ashish Jain>git config --list --show-origin file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true file:E:/programfiles/Git/etc/gitconfig credential.helper=manager file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true file:E:/programfiles/Git/etc/gitconfig core.fscache=true file:E:/programfiles/Git/etc/gitconfig core.symlinks=true file:E:/programfiles/Git/etc/gitconfig pull.rebase=false file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process - - - - - - - - - -When We Are in a Repository:
(base) C:\Users\Ashish Jain>cd C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing> (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>cd C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing (base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>git config --list --show-origin file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true file:E:/programfiles/Git/etc/gitconfig credential.helper=manager file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true file:E:/programfiles/Git/etc/gitconfig core.fscache=true file:E:/programfiles/Git/etc/gitconfig core.symlinks=true file:E:/programfiles/Git/etc/gitconfig pull.rebase=false file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process file:.git/config core.repositoryformatversion=0 file:.git/config core.filemode=false file:.git/config core.bare=false file:.git/config core.logallrefupdates=true file:.git/config core.ignorecase=true file:.git/config remote.origin.url=https://github.com/ashishjain1547/repo_for_testing.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 - - - - - - - - - -Check Which Entries Are At Which Level
(base) C:\Users\Ashish Jain\OneDrive\Desktop\repo_for_testing>git config --list --show-scope --show-origin system file:E:/programfiles/Git/etc/gitconfig http.sslcainfo=E:/programfiles/Git/mingw64/ssl/certs/ca-bundle.crt system file:E:/programfiles/Git/etc/gitconfig http.sslbackend=openssl system file:E:/programfiles/Git/etc/gitconfig diff.astextplain.textconv=astextplain system file:E:/programfiles/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f system file:E:/programfiles/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f system file:E:/programfiles/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process system file:E:/programfiles/Git/etc/gitconfig filter.lfs.required=true system file:E:/programfiles/Git/etc/gitconfig credential.helper=manager system file:E:/programfiles/Git/etc/gitconfig add.interactive.usebuiltin=true system file:E:/programfiles/Git/etc/gitconfig core.editor="E:\\programfiles\\Microsoft VS Code\\Code.exe" --wait system file:E:/programfiles/Git/etc/gitconfig core.autocrlf=true system file:E:/programfiles/Git/etc/gitconfig core.fscache=true system file:E:/programfiles/Git/etc/gitconfig core.symlinks=true system file:E:/programfiles/Git/etc/gitconfig pull.rebase=false global file:C:/Users/Ashish Jain/.gitconfig user.email=ashishjain1547@gmail.com global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.required=true global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.clean=git-lfs clean -- %f global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.smudge=git-lfs smudge -- %f global file:C:/Users/Ashish Jain/.gitconfig filter.lfs.process=git-lfs filter-process local file:.git/config core.repositoryformatversion=0 local file:.git/config core.filemode=false local file:.git/config core.bare=false local file:.git/config core.logallrefupdates=true local file:.git/config core.ignorecase=true local file:.git/config remote.origin.url=https://github.com/ashishjain1547/repo_for_testing.git local file:.git/config remote.origin.fetch=+refs/heads/*:refs/remotes/origin/* local file:.git/config branch.main.remote=origin local file:.git/config branch.main.merge=refs/heads/main
Thursday, August 26, 2021
Command 'git config'
Labels:
GitHub,
Technology
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment