Roey Angel
Roey Angel

Reputation: 2255

GitHub commits aren't recorded in the 'Your Contributions` calendar

I've been making continuous commits to my GitHub repos from my Linux shell and they show up nicely on the website just as they should. The only problem is that "Your Contributions" section doesn't show any recent activity. I have one green square from some day in November which I don't know how I got but all the other contributions don't show up in the calendar (but again, they do show up in their repos).

What am I missing here?

My github site

Upvotes: 199

Views: 144163

Answers (30)

SRJ
SRJ

Reputation: 47

I fixed the similar issue by Using GitHub profile's username as my git username in my local environment.

As a example, https://github.com/susithrj

set global username as susithrj in your local git config.

git config --global user.name "susithrj"

Upvotes: 1

Vishwanath gowda k
Vishwanath gowda k

Reputation: 1695

"You have to commit the changes with the same email id you used to login to your github account"

How to solve:

  • Change global email id for all repositories using following command.

    git config --global user.email [email protected]
    
  • Or Change email id for one particular repository. From inside the particlar repository run below command

    git config user.email [email protected]
    
  • Or in the repository open .git/config file and edit

    email = [email protected]
    name = abc
    

other causes can be found here https://help.github.com/articles/why-are-my-contributions-not-showing-up-on-my-profile/

Upvotes: 27

PANKAJ GUPTA
PANKAJ GUPTA

Reputation: 79

  1. Check in your VS Code github logined with same email.
  2. If you are working on different branch so merge it to the main branch all the contributions will show.

Upvotes: -1

Defcon41
Defcon41

Reputation: 177

enter image description here

Go to the repository settings and go to Default branch section and click the switch button and choose the other branch and save it.

  • Make sure your changes are notified to all who are contributing to the repo.

Upvotes: 3

Asadut Zaman
Asadut Zaman

Reputation: 313

I've just added my email again through the command line and it solves the issue:

$ git config user.email "[email protected]"

And another issue is regarding your branch. If you create another branch beside maser and try to push that branch this issue might occur. In my case I have started pushing to master and got the solution.

Upvotes: 6

Vadym
Vadym

Reputation: 1283

Adding secondary email to GitHub helped not only with the current problem but also to retrieve past commits/contributions.

If the email on the local machine doesn't match the one in the GitHub account - GitHub will not populate the contributions. As it was answered before, run the following command to determine which email is being used on the local machine: git config user.email. Proceed to https://github.com/settings/emails and add a secondary email, that you will find on your local machine.

Upvotes: 6

Milind Gour
Milind Gour

Reputation: 131

I resolved my error by :

I had uploaded the repo using : git remote add url "my-repo-link" git push url master

using url instead of origin did not show any green dots even after push , So , I created another repo , and re-init and commit and this time I write : git remote add origin "my-repo-link" git push origin master

All my previous commit to my ex-repo also added in my new repo ...saved my work and time

Upvotes: 0

Lying_cat
Lying_cat

Reputation: 1508

To those who still can't make it work after type in correct(you think) email and name in git config:

Remove the quotation marks that wrap the email and name.

This works for me, careless me..

Upvotes: 0

yogender
yogender

Reputation: 586

I had the same issue and figured out that I was not pushing to the origin/main branch, rather to some other branch. I solved it by merging the two branches. In addition, even if the two branches are merged, if the origin/main branch is behind several commits, still the contribution section would not update. one still need to do merging (kind of) to make sure that origin/main branch is updated all the time, do:

Note: (this solution will easily work for the local repo which is pulling from one remote and pushing to a different targeted repo (problamacic one))

  1. git pull origin main:temp

    • This will pull the main to a temp branch (temp is local branch), but still origin/main branch is behind several commits if one is pushing in more than one branch system. We need to chekout to temp branch to merge/move it forwards (so to speak)
  2. git checkout temp

    • it will turn from: (origin/main, origin/HEAD, temp) to->>>>>>>> (HEAD -> temp, origin/main, origin/HEAD) this means now HEAD is pointing to temp branch, so we can make it move forwards (so to speak) several commits (or merge whichever the case may be).
  3. git merge branch-second

    • Now we want to merge to branch-second: (origin/branch-second, main, branch-second) locally, which is several commits above temp after merge looks like this: (HEAD -> temp, origin/branch-second, main, branch-second)
  4. git push origin temp:main

    • Now push temp to main in the origin (origin means remote):
  5. git log --all --decorate --oneline --graph shows:

    • (HEAD -> temp, origin/main, origin/HEAD, origin/branch-second, main, branch-second)
so, the origin/main is merged and pushed to branch-second and all are at the same levels, and contribution started to show up:) hope it saves your time

checkout my medium article on the same: Medium

Upvotes: 1

Firoj Siddiki
Firoj Siddiki

Reputation: 1941

I solved it by making two changes

  1. I configured my local machine using command git config --global user.email "your github email"
  2. I changed my default branch of my project repo from main to master using github website @ https://github.com/your-username/your-repo-name/settings/branches

`

Upvotes: 7

Sumedh Deshpande
Sumedh Deshpande

Reputation: 546

I contacted Github Team for the same issue and this was their response hope this helps some of you

Contributions are counted if they meet certain criteria, described here:

https://docs.github.com/github/setting-up-and-managing-your-github-profile/why-are-my-contributions-not-showing-up-on-my-profile

You can find out why a specific commit to a public repository is not counting as a contribution using this app:

https://contribution-checker.herokuapp.com/ this contribution checker is very helpful it solved my problem

People often find they are missing contributions because their commits were authored by an email address that is not associated with their GitHub account, as described here:

https://docs.github.com/github/committing-changes-to-your-project/why-are-my-commits-linked-to-the-wrong-user

You can check the author of a commit by adding .patch to the end of the commit URL, like this:

https://github.com/github/linguist/commit/cfd5cbaba00122fceea1cfb108c5bdc3d451065a.patch

Upvotes: 3

Leo Lanese
Leo Lanese

Reputation: 496

for me was the file within the project:

/.git/config

...
[user]
    name = your user
    email = [email protected]
...

Inside the block [user] double-check the 'email' is correct (mine was incorrect) and the name is unique (mine was duplicated).

To double-check with contributor is increasing use:

git shortlog -sn

make a push, check which one is increasing the counter and that name should be the name inside the block [user]

Upvotes: 1

tbs
tbs

Reputation: 480

Make sure to use the the user flag. For example git push -u origin instead of git push

Upvotes: 1

Mehdi Ijadnazar
Mehdi Ijadnazar

Reputation: 4991

GitHub clearly states how they measure your contributions in their Help:

  • Issues and Pull Requests:

    • Only if they were opened in a standalone repository, not a fork
  • Commits:
    Only if they meet all of the following conditions:

    • The email address used for the commits is associated with your GitHub account

    • The commits were made in a standalone repository, not a fork

    • The commits were made:

      • In the repository's default branch (usually master)
      • In the gh-pages branch (for repositories with project sites)

    In addition, at least one of the following must be true:

    • You are a collaborator on the repository or are a member of the organization that owns the repository
    • You have forked the repository
    • You have opened a pull request or issue in the repository
    • You have starred the repository

Note: After making a commit that meets the requirements to count as a contribution, you may need to wait for up to 24 hours to see the contribution appear on your contributions graph

Upvotes: 5

GinTonic
GinTonic

Reputation: 1000

The "Contributions Calendar" or "Activity overview" on github is only recording the commits that are related to the mail address that is recorded in the github account.

Change the mail address for all future commits

As already noted by many others in this thread, look up the current locally saved email address by:

git config user.email

If it doesn't match the mail on github, change using:

git config --global user.email [email protected]

This will globally change the mail address for all future commits but will not affect the "Contributions Overview" for the past ones. You can follow the official docs for an extended description.

Change the mail address to update the overview for the past commits

You realize that many of your past commits have not been recorded correctly in the Github "Contributions Overview": enter image description here

To change that, you can change the author info for the repositories by following the steps explained in the official github docs.

A short summary:

  1. Open git bash
  2. Clone a bare repository

    git clone --bare https://github.com/user/repo.git
    cd repo.git
    
  3. Paste the following code into the git bash console after changing the variables OLD_EMAIL, CORRECT_NAME and CORRECT_EMAIL:

    #!/bin/sh
    
    git filter-branch --env-filter '
    
    OLD_EMAIL="[email protected]"
    CORRECT_NAME="Your Correct Name"
    CORRECT_EMAIL="[email protected]"
    
    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
    
  4. Press enter to run the script

  5. Push the corrected history to github
    git push --force --tags origin 'refs/heads/*'
    

This procedure should update the "Contributions Overview" and now also show the commits not shown before: enter image description here

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.

Upvotes: 4

Hadi Mir
Hadi Mir

Reputation: 5133

I had the same problem and the solution was pretty simple. I had the wrong email set for the global email config

git config --global user.email "[email protected]"

Just make sure the above email and your GitHub account email are same

Upvotes: 3

Jonathan Mendoza
Jonathan Mendoza

Reputation: 480

Had same problem, mine was fixed by setting the email

git config --global user.email [email protected]

Hope this helps.

Upvotes: 3

geekidharsh
geekidharsh

Reputation: 3599

so this usually happens due to a lot of factors, for which you must visit this GitHub help

The most common mistakes I found were :

  1. Email not configured properly on local machine. (your laptop/pc).
  2. Forking.
  3. Not using default or gh-pages branch for commit.

I personally had issue 1 recently, for which I went to my terminal/cmd/cli and configure my email address locally by running this command

git config --global user.email [email protected]

Once that's done, try running this config again like this:

git config --global user.email

You should be able to see:

[email protected]

If this was correct, you have successfully configured your local machine with your global public repo. Now your next commit will be credited towards your calendar.

Upvotes: 23

Bitto
Bitto

Reputation: 8245

You can keep your email private and still have the contributions show up in your calendar. You can choose to keep your email address private from the github email settings and use the github noreply email address in your git config.

git config user.email "[email protected]"

Note

For me, I had chosen to keep my email private from the github email settings. This gave me an error

Your push would publish a private email address.

while trying to push to my repo. I removed the email. Pushing after this was successful but the contributions were not recorded in my calendar.

As mentioned by GitHub in the email settings page

We’ll remove your public profile email and use [email protected] when performing web-based Git operations (e.g. edits and merges) and sending email on your behalf. If you want command line Git operations to use your private email you must set your email in Git.

Upvotes: 2

bsh
bsh

Reputation: 171

I checked the "Insights" section/tab of my repository, and instead of my current user, there was a anonymous user (which was also me), so I changed the email config in my current computer to the one that I use github with as described above.

Insigths

Upvotes: 1

mwen1993
mwen1993

Reputation: 63

I had the same exact problem, turns out it is because the email on my local git does not match the email on my GitHub account.

To update the email on your local machine:

git config --global user.email "[email protected]"

Verify that all your commits are updated on your github, if not you can check individual commits to see what email the commit is associated with by clicking on the commit and adding ".patch" to the end of the commit url like this:

https://github.com/username/repoName/commit/9fbe83f71cfc3503.patch

Now all you have to do is add that email you see to your account.(It does not need to be verified)

Check the commit again and you should see your username and credited :)

Upvotes: 4

lockjohn
lockjohn

Reputation: 11

I had to restore my laptop recently and forgot to reconfig my email to git. My laptop username looks similar to my git one, so I just blindly thought my commits were being attributed correctly. As posted, you can change your global email settings. However, if you want to correct the miss-attributed commits on your project, you can use this run this script to create an alias gca that you can run in your git project directory to change the authorship of your past commits.

From your ~ directory, add:

$ cat <<EOF >> ~/.aliases
 function git_change_authorship {
 git filter-branch -f --env-filter "
  GIT_AUTHOR_NAME=\"\$1\"
  GIT_AUTHOR_EMAIL=\"\$2\"
  GIT_COMMITTER_NAME=\"\$1\"
  GIT_COMMITTER_EMAIL=\"\$2\"
 "
 }
 alias gca=git_change_authorship
 EOF

 $ source ~/.aliases

then in your git project directory run gca <git username> <git email address>

Heads up! I have only used this in my own personal projects where I have been the sole committer. Haven't had a chance to test it out with group projects, so proceed cautiously.

Upvotes: 1

Cons Bulaquena
Cons Bulaquena

Reputation: 2113

I had the same issue in Xcode 9 for iOS development.

In Github, I noticed a non-committer author. enter image description here

Even though I made commits in Xcode. There was no contributions in the 'Your Contributions` Calendar.

Solution:

Change Committer Name and Email Globally
The email address used for the commits must be associated with your GitHub account.

In the Terminal:

$ git config --global user.name "Full Name"
$ git config --global user.email "[email protected]"

See also GitHub Help: Setting your commit email address in Git

Upvotes: 8

Cesare
Cesare

Reputation: 9419

Turns out I previously changed my email address on GitHub and I forgot to change the local one, too.

Upvotes: 5

Frederick G. Sandalo
Frederick G. Sandalo

Reputation: 929

You can go to https://github.com/settings/emails and add the email that you are using with git config --global user.email

Upvotes: 3

Guohua
Guohua

Reputation: 191

Maybe Github had fixed this problem. There is one simple way, go to github.com email setting: https://github.com/settings/emails

Personal settings --> Emails

You can add email address there, and verify your newer email address with send a verification link, then you will find your previous commits are all recorded in the 'Your Contributions` calendar. And this email verification will also let you receive notifications and password resets from GitHub.

Your new email address will be used for account-related notifications (e.g. account changes and billing receipts) as well as any web-based GitHub operations (e.g. edits and merges).

Upvotes: 13

epicrato
epicrato

Reputation: 8428

Make sure your local email is the exact same that the one in the account.

Go to the terminal and inside the folder you are pushing the commits, run:

git config --global user.email
  #=> [email protected]

git config --system user.email
  #=> 

git config --local user.email
  #=> [email protected]

Something similar was happening to me. The email in my account was the one in the --global, but my --local was slightly different, it had not '.'.

(In Gmail there is no difference between those emails, they work the exact same).

Upvotes: 15

knutigro
knutigro

Reputation: 1092

I hade to manually add my email to SourceTree settings even if git config had the right email address configured. Only after doing this, GitHub started recording my commits to my contribution graph.

SourceTree Settings Screenshot

Upvotes: 4

aaaronic
aaaronic

Reputation: 445

I had issues seeing attributions for commits on a private repo that was added to my organization after many of my commits occurred (new commits were showing up properly) and was only able to get them to show up by removing the email address from my profile, then re-adding the same email address.

It seems like doing this cleared up a caching issue within GitHub.

Upvotes: 5

Stephen &#211; Connor
Stephen &#211; Connor

Reputation: 376

I had the same problem and this worked for me: GitHub contribution checker, link below. Once installed, the program checks the validity of your recent commits and gives you a list of rules, with the rule/rules not met in red.

My problem was GitHub was using a Cygwin terminal name as an email address so I just added my Cygwin terminal name to my profile and all recent commits were added to my GitHub calendar.

Your commit will not be counted as a contribution! Check the details below: https://github.com/jdennes/contribution-checker

Upvotes: 3

Related Questions