Git author Unknown

后端 未结 5 926
南方客
南方客 2020-12-08 00:37

my author name in all my commits is coming up as unknown https://github.com/freeenergy/Teacher-Login-Validation-Module

did this

$ git config         


        
5条回答
  •  悲哀的现实
    2020-12-08 01:24

    In case you did already push your commits with a wrong user, you can rewrite the history using this script from github:

    #!/bin/sh
    
    git filter-branch --env-filter '
    OLD_EMAIL="your-old-email@example.com"
    CORRECT_NAME="Your Correct Name"
    CORRECT_EMAIL="your-correct-email@example.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
    

    Be aware of the effects a history rewrite has! If you are on a private branch you will propably be fine. On branches that are shared with other users you will need to coordinate with every other user and do a fetch on each clone. You need to decide if it's worth the effort. Have a backup!

提交回复
热议问题