简体   繁体   中英

Changing Git author info not working

I'm following contents in this link which is straight forward to change author name in github repo for all the commits I have made.

I followed the steps and ran the following script.

git filter-branch --env-filter '
OLD_EMAIL="myoldemail@someotherdomain.com"
CORRECT_NAME="myname"
CORRECT_EMAIL="myname@gmail.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_COMMITTER_NAME="$CORRECT_NAME"
    export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
fi
if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ]
then
    export GIT_AUTHOR_NAME="$CORRECT_NAME"
    export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
fi
' --tag-name-filter cat -- --branches --tags

The result of the script is as below:

Rewrite ae90f4a2d7fe9288d678c5d530347c00f085c268 (443/443)
WARNING: Ref 'refs/heads/accounts_migration' is unchanged
WARNING: Ref 'refs/heads/campaigns' is unchanged
WARNING: Ref 'refs/heads/email' is unchanged
WARNING: Ref 'refs/heads/event_tracking' is unchanged
WARNING: Ref 'refs/heads/highcharts_integration' is unchanged
WARNING: Ref 'refs/heads/inapp_coupon' is unchanged
WARNING: Ref 'refs/heads/master' is unchanged
WARNING: Ref 'refs/heads/staging' is unchanged

It says all the branches are unchanged , even though i have commits in the name of myoldemail@someotherdomain.com .

Am i missing something here or doing something wrong ?

If you are creating an executable file and then execute the command somehow it is not working. However, if you try to execute the command from command-line then it will make the changes you want.

Did you repeat the "straight forward" instructions step-by-step? Especially, did you do a fresh checkout of the repository?

The instructions are working fine for me. The only issue I can think of are existing backups from previous filter attempts. In that case, the refs won't be changed.

(You can force the filter to process with the -f -switch, which deletes the backup. However, there is probably a good reason why this is not done in the instructions.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM