Git author Unknown

后端 未结 5 888
南方客
南方客 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:13

    I was having the issue of Github not properly linking my commits to my account. If you believe your email is correct, you should ensure that email is also in the Github settings for your account, as per this help page. The last section of caching is also good to note.

    Copied in case of a catastrophic event in which Github goes down or ceases to exist.

    Why are my commits linked to the wrong user?

    GitHub uses the email saved in a commit's header to link the commit to a GitHub user. If you find your commits are being blamed on another user, or not linked to a user at all, you should check your settings.

    Good to know: commit blame does not grant access to a repo. If you are seeing commits blamed on a user you do not know, don't worry. The user does not have access to your repo unless you've explicitly added them as a collaborator on that repo or to a team that has access to the repo.

    Make them match

    In order for GitHub to properly blame you for your commits, make sure your git email setting is correct and matches an email attached to your account.

    Configuring git

    To check your git setting, run this command:

    $ git config user.email
    # you@there.com
    

    If this email is not correct, you can change the global setting:

    $ git config --global user.email "me@here.com"
    

    Good to know: if you work on multiple machines, you will need to check this setting on each one.

    Attach the email to your GitHub account

    If your email is not attached to your GitHub account you will need to add it for your future commits to be blamed correctly.

    1. Go to your Account Settings
    2. Click "Emails"
    3. Click "Add another email address"
    4. Enter the email address and click "Add"

    The past is history

    If you used an invalid email, or an email that's already attached to another account, then your previous commits will not be blamed correctly. While git does allow you to modify the repo's history and correct this, it is strongly discouraged to change commits which you've pushed to a remote repo.

    In the case where your previous commits used the correct email, after you add the email to your account they will start to link. However, it may take some time for the old data to fall out of the server's cache before this happens.

    Moving forward, if your settings match then all your new commits will be blamed on you and linked to your account.

提交回复
热议问题