목차
[Settings > Access > Emails](<https://github.com/settings/emails>)
에서 변경하고자 하는 이메일을 추가한 뒤 기본 이메일 변경
<aside> ⚠️ GitHub 계정의 이메일을 삭제하는 경우 잔디가 사라지는 현상 발생!!
GitHub 계정의 이메일과 해당 커밋의 작성자 이메일이 동일해야 잔디가 심어진다.
</aside>
사용자 이름 및 이메일 변경
# 전역 설정 (위치: ~/.gitconfig)
$ git config --global user.name "변경 후 이름 "
$ git config --global user.email "변경 후 이메일"
# 저장소 별 설정 (위치: [REPO]/.git/config)
$ git config user.name "변경 후 이름 "
$ git config user.email "변경 후 이메일"
# 설정 확인
$ git config --list
기존 이메일을 제거하지 않고 서브 이메일로 사용하는 방법이 제일 안전하다.
기존 이메일을 제거하는 경우 복구할 저장소의 전체 커밋을 강제(--force)로 변경해야 한다.
# git-filter-repo 설치
$ python3 -m pip install --user git-filter-repo
Requirement already satisfied: git-filter-repo in /root/.local/lib/python3.6/site-packages
$ git --exec-path
/usr/lib/git-core
$ cp /root/.local/bin/git-filter-repo /usr/lib/git-core/
# Ensure '<[email protected]> <root@localhost>' is a line in .mailmap, then:
git filter-repo --use-mailmap
$ add-apt-repository ppa:git-core/ppa -y
$ apt-get update
$ apt-get install git -y
# 이름/이메일 일괄 변경
$ git filter-repo --force --name-callback 'return name.replace(b"OLD NAME", b"NEW NAME")'
$ git filter-repo --force --email-callback 'return email if email != b"OLD EMAIL" else b"NEW EMAIL"'
$ git remote add origin 깃경로
$ git push -f origin main
[Git] 이미 푸시된 커밋들의 작성자(Author) 일괄 변경하기 (feat. GitHub 잔디 누락)
dev-tips/Git-여러-commit의-author를-바꾸는-방법.md at master · HomoEfficio/dev-tips