본문 바로가기
Tools/Git

[Git] push 수행시 'push.default is unset' 에러

by A6K 2021. 2. 13.

git을 이용해 로컬에 반영된 커밋을 리모트 저장소로 push 할 때, "warning: push.default is unset;"이라는 에러 메시지가 출력되는 것을 볼 경우가 있다. 예를 들어 다음 에러 메시지가 보이는 경우다.

$ git push
warning: push.default is unset; its implicit value has changed in
Git 2.0 from 'matching' to 'simple'. To squelch this message
and maintain the traditional behavior, use:

  git config --global push.default matching

To squelch this message and adopt the new behavior now, use:

  git config --global push.default simple

When push.default is set to 'matching', git will push local branches
to the remote branches that already exist with the same name.

Since Git 2.0, Git defaults to the more conservative 'simple'
behavior, which only pushes the current branch to the corresponding
remote branch that 'git pull' uses to update the current branch.

See 'git help config' and search for 'push.default' for further information.
(the 'simple' mode was introduced in Git 1.7.11. Use the similar mode
'current' instead of 'simple' if you sometimes use older versions of Git)

git push 명령에 적용되는 push.default 설정 값이 Git 2.0부터 'matching'에서 'simple'로 바뀌었다는 내용이다. 암묵적으로 기본값을 사용하는 유저들은 과거 버전과 현재 버전의 동작이 다르니 주의하라는 의미다.

git push 명령에서 'push.default' 설정 값이 simple이면 현재 작업중인 브랜치만 리모트 저장소로 push한다. 설정값이 matching이면 로컬과 리모트 저장소에서 브랜치 명이 동일한 모든 브랜치를 push 하겠다는 의미다. simple의 경우 현재 작업중인 브랜치만 push하고, matching은 로컬에 있는 모든 브랜치와 리모트에 있는 브랜치를 항상 동일하게 유지하고 싶을 때 사용된다.

'push.default' 설정은 다음 명령으로 할 수 있다. (~/.gitconfig 파일을 수정한다)

git config --global push.default [simple or matching]

현재 저장소의 설정 값에만 적용하고 싶은 경우에는 --global 대신 --local을 사용하면 된다. (현재 저장소의 .git/config 파일을 수정한다)

git config --local push.default [simple or matching]

만약 시스템에 있는 모든 사용자들에게 적용하고 싶다면 --system을 고치면 된다. (/etc/gitconfig 파일을 수정한다)

댓글