1

My Github contributions aren't being tracked when I commit from the command line and I can't figure out why.

My git config user.email and git config --global user.email and my primary email on Github all match.

However, when I went on the github site and deleted a file from a PR through the GUI, and committed it, that showed up as a contribution.

Any ideas? Thanks!

torek
  • 448,244
  • 59
  • 642
  • 775
mmmgailad
  • 33
  • 3
  • 1
    Regarding your last sentence, after doing that, I assume that commit is now on the default branch? – TTT Dec 22 '21 at 22:59

3 Answers3

2

There are a couple possibilities:

  • You haven't pushed them to GitHub.
  • Your changes aren't in the main repository, but a fork.
  • Your changes aren't in the default branch.

GitHub has documentation on the reasons this can happen.

bk2204
  • 64,793
  • 6
  • 84
  • 100
  • 1. I have pushed them to github 2. The changes are on a branch that has an open PR to the main repo Why would my commit that I pushed from the github website show up in my contributions but not those from the command line? – mmmgailad Dec 22 '21 at 21:43
  • 2
    If your contributions are not merged into the main branch (that is, they're just in a PR), then they don't count. – bk2204 Dec 23 '21 at 01:04
0

You need to use the git push command to push the changes to the repository on GitHub. Otherwise, the changes will take effect in your local repository.

# After making changes to the local repository, use the command below to monitor all those changes.
git add .

# Use the command below to commit all changes.
git commit -m "Message"

# Run the following command for the changes to take effect in the repository on GitHub:
git push -u origin feature
# If your branch name is "main" use it like this:
git push -u origin main
Sercan
  • 4,739
  • 3
  • 17
  • 36
  • I have been pushing them and they still dont show up :( – mmmgailad Dec 22 '21 at 21:38
  • After you create the project on github, pull it to your local. This way the remote connection is set up correctly. Then, when you follow the steps I mentioned above, the changes will be applied to your GitHub account. – Sercan Dec 22 '21 at 21:52
  • If there is a problem with authorization follow [this link](https://stackoverflow.com/questions/35942754/how-can-i-save-username-and-password-in-git). – Sercan Dec 22 '21 at 21:56
  • To check authorization, in Windows 10, go to `Control Panel > User Accounts > Credential Manager`. In this field `git:https://github.com` **must have the correct username and password**. – Sercan Dec 22 '21 at 22:00
  • Did you solve the problem? Alternatively, start a project in VS Code and try to push through the interface to upload it to the remote repository. Getting the right authorization can help you indirectly through this process. – Sercan Dec 23 '21 at 03:26
0

If your git config user.email and git config --global user.email and your primary email on Github all match. Then the issue might be because of the below suggestion.

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.

Got this from the GitHub Docs

Gino Osahon
  • 399
  • 1
  • 6