깃허브/여러가지 기능

깃 push 이후 사용자 name, email 변경

have a good time 2021. 12. 11. 19:11

사용자 계정 A 이메일과, B 이름으로 

이미 깃허브에 push 한 상태인데,

 

C 이메일과 D 이름으로 이미 깃허브에 push 한 내용에 대해 변경하고 싶다면,

 

 

 

<깃 bash 창에 아래와 같이 입력>

 

$ git filter-branch --env-filter '
WRONG_EMAIL="wrong@example.com"
NEW_NAME="New Name Value"
NEW_EMAIL="correct@example.com"

if [ "$GIT_COMMITTER_EMAIL" = "$WRONG_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$NEW_NAME"
    export GIT_COMMITTER_EMAIL="$NEW_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$WRONG_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$NEW_NAME"
    export GIT_AUTHOR_EMAIL="$NEW_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

 

 

 

----------------------------------------------------------(점선 위 내용 입력)

 

 

여기서, 

WRONG_EMAIL="wrong@example.com"
NEW_NAME="New Name Value"
NEW_EMAIL="correct@example.com"

 

이 부분만 수정해주면 된다.( 따옴표 있는 부분 수정, 따옴표도 같이 입력해줘야 함)

 

참고 자료 : https://yoonbh2714.blogspot.com/2018/04/git-push-name-email_25.html

 

git push 된 커밋 사용자 name, email 변경

관심가는 것들을 기록하고 공유하는 소프트맨 블로그입니다.

yoonbh2714.blogspot.com

 

https://www.git-tower.com/learn/git/faq/change-author-name-email

 

How can I change the author (name / email) of a commit?

Find out how to change the author information of a revision both before or after making the commit.

www.git-tower.com

 

위에서 설명한 방법 외에도 다른 방법이 있으니

아래 자료 참고

https://sunghs.tistory.com/129

 

[Git] Push Author 변경하기

Git Push Author 변경하기 IntelliJ 등 IDE 에서 여러 Git 호스팅 서버 (깃랩, 비트버킷 )등 을 이용하다보면 기존 프로젝트를 가져왔을 때 login user가 다른 호스팅 서버 아이디로 되어 있는 등 commit author가

sunghs.tistory.com