본문 바로가기

Git

[Git] config

반응형

▪ Synopsis

내 정보를 설정하지 않고 git commit 명령어를 실행하면 "***Please tell me who you are."의 출력과 함께 Commit에 실패합니다.
설정된 config 정보는 --list 혹은 -l option으로 확인 가능합니다.
$ git config --system --list # System 설정 파일을 확인 
$ git config --global --list # Global 설정 파일을 확인
$ git config --local --list  # Local 설정 파일을 확인 
$ git config --list          # 모든 설정 파일을 확인

 

정보를 설정 설정하려면 user.name과 user.email을  --system, --global, --local option을 통해 설정 할 수 있고 설정된 option의 우선 순위 Local>Global>System 순으로 Local 설정 파일이 제일 높습니다.

$ git config --global user.name "user_id"
$ git config --global user.email "email_id@email"

 

▪ Usage

전역 사용자 설정 구성

$ git config --global user.name "user_name"
$ git config --global user.email "user_email@example.com"

 

 

설정 조회

$ git config --list

 

특정 설정값 조회

$ git config user.name
$ git config user.email

 

로컬 저장소 설정 구성

$ git config core.autocrlf true

 

시스템 전체 설정 구성

$ git config --system core.editor "vim"

 

삭제

$ git config --unset user.email

 

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-pattern]
    --get-all             get all values: key [value-pattern]
    --get-regexp          get values for regexp: name-regex [value-pattern]
    --get-urlmatch        get value specific for the URL: section[.var] URL
    --replace-all         replace all matching variables: name value [value-pattern]
    --add                 add a new variable: name value
    --unset               remove a variable: name [value-pattern]
    --unset-all           remove all matches: name [value-pattern]
    --rename-section      rename section: old-name new-name
    --remove-section      remove a section: name
    -l, --list            list all
    --fixed-value         use string equality when comparing values to 'value-pattern'
    -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
    --bool-or-str         value is --bool or string
    --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
반응형

'Git' 카테고리의 다른 글

[Git] clone (--mirror)  (0) 2024.01.14
[Git] log  (0) 2024.01.14
[Git] submodule  (0) 2022.09.07