이전 글의 마지막에서도 git을 시작한 이후 사용자 등록에 대해 간략하게 써 놓았다. (아래 글 참조)

2022.06.25 - [프로그래밍/GIT] - (0) GIT 이란?

 

이번에는 사용자 등록에 대한 기본적인 내용을 복기하고 등록된 사용자 확인 및 error상황에 원인을 확인하고 해결하고자 한다. 

 

1. 사용자 등록 및 확인


어떤 버전을 누가 언제 만들었는지 쉽게 파악하기 위해 사용자 정보를 입력해야 한다.

git config 명령을 사용하며 --global 옵션을 추가하면 현재 컴퓨터에 있는 모든 저장소에서 같은 사용자 정보를 사용하도록 한다.  추가로 등록된 사용자를 확인하기 위해서 --get user.name --get user.email --list 옵션을 사용한다. 

 

//사용자 등록
git config --global user.name "someone" // 사용자의 이름을 등록
git config --global user.email "email" // 사용자의 이메일 등록
//등록된 사용자 확인
git config --get user.name // 사용자의 이름 확인
git config --get user.eamil // 사용자의 이메일 확인

git config --list //config에 등록된 정보 확인

 

<git config --list 출력결과>

<git config --list 출력결과>

 

git config --list
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
http.sslbackend=openssl
http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
core.autocrlf=true
core.fscache=true
core.symlinks=false
credential.helper=manager-core
pull.rebase=false
credential.https://dev.azure.com.usehttppath=true
init.defaultbranch=master
user.name=someone
user.email=email
core.repositoryformatversion=0
core.filemode=false
core.bare=false
core.logallrefupdates=true
core.symlinks=false
core.ignorecase=true

 

 

2. 등록된 사용자 변경 및 삭제


기존에 등록된 사용자의 정보를 변경하기 위해선 기존에 사용하였던 git config --global user.name  

git confir --global user.email 명령어를 재사용해주면 된다. 

 

//사용자 변경
git config --global user.name "someone" // 변경할 사용자의 이름을 등록
git config --global user.email "email" // 변경할 사용자의 이메일 등록

 

기 등록된 사용자의 정보를 삭제하고 싶을 땐 git config --global --unset user.name

git config --global --unset user.email 명령어를 사용한다. 확인은 동일하게 git config --list를 사용하면 기존에 등록했던 정보(user.name, user.email)가 사라진다,

//사용자 삭제
git config --global --unset user.name // 사용자의 이름을 삭제
git config --global --unset user.email // 사용자의 이메일 삭제

//삭제 여부 확인
git config --list

 

3. 사용자 미등록 오류 (error)


등록된 사용자가 없는 상태로 commit을 하게 되면 다음과 같은 에러가 발생한다. 

커밋을 하려고 하는 사람이 누군지 모르니 등록을 해달라고 하는 부분이다. 

그럼 사용자 등록을 해주면 간단히 해결된다. 

 

$ git commit -m "add test.txt"
Author identity unknown

*** Please tell me who you are.

Run

  git config --global user.email "you@example.com"
  git config --global user.name "Your Name"

to set your account's default identity.
Omit --global to set the identity only in this repository.

 

 

<해결방법>

//사용자 등록
git config --global user.name "someone" // 사용자의 이름을 등록
git config --global user.email "email" // 사용자의 이메일 등록

 

 

 

 

*Reference

- "지옥에서 온 문서 관리자 깃&깃허브 입문" 이지스버블리싱 - 이고요, 고경희 지음

 

부족한 글이지만 읽어주셔서 감사합니다. 

+ Recent posts