简体   繁体   中英

Git contributions not showing up on GitHub

I went through your following article https://help.github.com/articles/why-are-my-contributions-not-showing-up-on-my-profile/ for contribution not being shown on my profile.

To say the least.

  • I am pushing commits on my own repository master branch and I can see those commits on GitHub but they aren't being added in my contribution.
  • Its been more than 24 hours and in multiple directories. No, None of the repository I am pushing my commits are forked.

  • They are no contributors to the given repository so I can push commits.

[Question:] Can someone tell me what wrong I could be doing? or how to fix it?

My git repository is: https://github.com/irohitb

Example: Consider this repository -> https://github.com/irohitb/Crypto , Here it says last commit was pushed 4 days ago but in my contribution, it doesn't show any contribution which I did in past week

Check your git config user.name and git config user.email .

Your user.name should be irohitb , after your GitHub account .

The commit of the repo you mention ( commit 0733750 ) shows:

Rohit Bhatia authored and Rohit Bhatia committed 4 days ago

In both instances, GitHub does not show a link to github.com/irohitb , which means the user.name or user.email didn't match the login/email of your GitHub account.

You would need to change the author of your past commits to rectify the situation.
See this example .

GitHub uses only the commiter's email-address to determine their "identity".

If you use multiple email addresses, you can add all of them on GitHub's Setting page .

Note, that you have to validate each email address you want to add: so you really can only add valid (as in: they are accepted by a public mailserver) email addresses. an address like <Rohit@Rohits-MacBook-Pro.local> cannot be validated, so you can't add it (and you should use git config user.email to set a valid email-address instead.)

PRO tip : you git config --global user.email to set your user-email for all repositories not just the one you are currently working with (a repository-local configuration will override the global settings).

In some cases, the git configuration on your computer might have the wrong email address. In my case it was, for some reason, set to the computer name so wasn't even an email. To check this, go to a commit that is not showing in the graph and add ".patch" to the end of the URL. This will show you the email address of the committer.

To change the author info on your commits, you can follow this help article on github . It has a script that will rewrite the history of all your commits and fix the author/committer info.

From the article:

Warning: This action is destructive to your repository's history. If you're collaborating on a repository with others, it's considered bad practice to rewrite published history. You should only do this in an emergency.

Any collaborators will have to fetch the new history.

Note: Running this script rewrites history for all repository collaborators. After completing these steps, any person with forks or clones must fetch the rewritten history and rebase any local changes into the rewritten history.

Steps from the article:

  1. Create a fresh bare clone git clone --bare https://github.com/user/repo.git
  2. Copy and paste the script, replacing the following variables based on the information you gathered:

    OLD_EMAIL CORRECT_NAME CORRECT_EMAIL



    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

Just do it again:

git config --global user.name "usuario"

git config --global user.email "email@email.com"

simple like that... happens to me once...

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