0

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
  • 389,216
  • 48
  • 524
  • 664
  • 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

2 Answers2

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
  • 48,483
  • 5
  • 42
  • 63
  • 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? – Madelyn Adams Dec 22 '21 at 21:43
  • 1
    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
  • 3,878
  • 3
  • 12
  • 31
  • I have been pushing them and they still dont show up :( – Madelyn Adams 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