Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

Select Topic Area

Question

Body

I accidentally removed my primary email, but I re-added it immediately and successfully verified it. However, all of my past contributions have disappeared and haven’t been restored.
Does anyone know how to fix this?

You must be logged in to vote

Replies: 4 comments

Comment options

When you remove your primary email address from your GitHub account, any contributions (commits, PRs, etc.) that were made with that email may temporarily disappear from your contributions graph and history. If you re-add and verify the same email address, those contributions should typically reappear, as long as the email in your commit history matches exactly with the verified email on your account.

If your contributions have not been restored after re-adding and verifying your email:

  • Double-check that the email you re-added is exactly the same (no typos, correct capitalization) as the one used in your commits.
  • Try signing out and back in, or clearing your browser cache, to make sure the site is displaying up-to-date information.
  • If the email was previously associated with a different GitHub account, you might need to unlink it there before it can be fully linked and credited to your current account.

If everything checks out but the problem persists, refer to the official documentation:

If you still can't recover your contribution history, you may need to contact GitHub Support directly for further investigation.

You must be logged in to vote
0 replies
Comment options

When you remove and then re-add your primary email, GitHub may temporarily lose track of your past contributions because it ties commits to verified emails.
To fix this:

  • Ensure the re-added email is exactly the same and verified in your GitHub account.
  • Wait up to 24 hours for GitHub to refresh your contributions graph.
  • Sign out and sign back in, or clear your browser cache to rule out display issues.
  • Double-check your commits use the correct email in their metadata (git log can help).
  • If after 24 hours contributions are still missing, contact GitHub Support with details for help restoring them.

Usually, contributions return automatically once GitHub reprocesses the verified email association.

You must be logged in to vote
0 replies
Comment options

@Willium1925 I think u should wait for some hours then try or u can check by GitHub desktop if in your GitHub desktop repo are showing that good they will also come but if in ur desktop they are not then that will be problem. then us should contact to GitHub.

You must be logged in to vote
0 replies
Comment options

Fix: Commits not showing on contribution graph after re-adding your email (solely for solo private repo).

I retrieved my contributions with my files intact.

This fix is only recommended for missing contributions in your solo private repos. For a repo shared with other people, this kind of fix will break their copies. If your repo is public and you follow my guide, you will accidentally share your email to the public (e.g. someone can add a ".patch" file at the end of a commit in your public repo to see your email). I do think it's best to contact Github Support if you have missing contribution in a public and shared repo .

Why it happens

Every Git commit has a unique hash (a commit ID). That hash is generated from the commit’s contents and metadata such as the author email, timestamps and commit message. If any of that changes, the commit gets a completely new hash.

GitHub links commits to your contribution graph using the email address stored in the commit metadata. If commits were made with an email that is no longer associated with your account, or an email that was temporarily removed/unverified, GitHub may stop attributing those commits to you.

The commits still exist normally in the repository, but GitHub no longer associates them with your profile contributions.

What we'll do

We’ll rewrite the commits so they contain your currently verified GitHub email address. That creates brand-new commit hashes. When GitHub scans the rewritten commits, it sees your verified email attached to them and can associate them with your contribution graph again. We’ll also preserve the original commit dates so the contributions stay on the correct calendar days.

Before you start

Please make sure:

  1. You fully quit your code editor (RStudio, VS Code, PyCharm, etc.). Quit the whole app, not just close the window. Editors sometimes recreate temporary files or automatically save changes during a history rewrite, which can interfere with the process.
  2. The email is already verified on GitHub.
  3. The repo is one you manage alone.
  4. The commits are on the repo’s default branch (main, usually).

We’ll do everything from the Terminal of your computer.

Step 1: Back up the repo

Stand in the folder that contains your repo, then make a copy:

cd ~/Desktop                                  # the folder your repo lives in
cp -r my-repo my-repo-backup                  # make a full backup copy
cd my-repo                                     # go into the repo to work

Replace my-repo with your actual folder name, e.g. health-stats.

cd ~/Desktop
cp -r health-stats health-stats-backup
cd health-stats

If anything goes wrong later, you can delete the broken folder and copy the backup back.


Step 2: Make sure you have no uncommitted changes

The rewrite won't run if you have edits you haven't committed yet. Check:

git status
  • If it says "nothing to commit, working tree clean" → good, go to Step 3.
  • If it lists modified files → you have uncommitted changes. Pick one option from two options below. Do not run both.

Keep them (set aside safely, bring back later):

git stash

Throw them away (you don't want them):

git checkout -- .

Now we run git status again. It should now say the working tree is clean.


Step 3: Rewrite every commit (the core step)

This gives each commit a new hash, stamps your correct email, and keeps the original dates (so the squares land on the right days).

git rebase --root --exec 'GIT_COMMITTER_DATE="$(git show -s --format=%aI HEAD)" git commit --amend --no-edit --author="Your Name <your-verified-email@example.com>"'
  • Replace Your Name with your GitHub username. etc.
  • Replace your-verified-email@example.com with the email you verified.

If it finishes with Successfully rebased and updated refs/heads/main → great, skip to Step 5.


Step 4: Only if Step 3 stopped with an error about "untracked working tree files"

The rewrite rebuilds your history from the first commit, and it stops if random clutter files are sitting in the way. The good news:
the error message lists the exact files blocking it. Just delete those and rerun.

These are almost always auto-generated junk (caches, editor settings, system files) that's safe to delete and regenerates later:

  • Any Mac: .DS_Store
  • R / RStudio: .Rproj.user/, .RData, .Rhistory
  • Python / Jupyter: __pycache__/, .ipynb_checkpoints/, *.pyc
  • JavaScript / Node: node_modules/
  • JetBrains IDEs: .idea/

Delete whatever the error named, for example:

rm -f .DS_Store                                # deletes a file
rm -rf .Rproj.user __pycache__ .ipynb_checkpoints   # deletes folders + contents

Then run the rebase command from Step 3 again. If it stops on different files, repeat, delete what it names, rerun, until you see Successfully rebased and updated refs/heads/main.


Step 5: Check your commit history (both the ones available and missing from the contribution graph)

git log --pretty=format:"%h %ad %ae" --date=short | head -20

git log → "show me the commit history"
%h = the hash (e.g. 2b7c206)
%ad = the author date
%ae = the author email
| head -20 → "only show the first 20 lines".

Confirm: dates are unchanged, the emails match your verified email.


Step 6: Push the rewritten history

git push --force-with-lease origin main

If it's rejected with "stale info":

git fetch origin
git push --force origin main

If you get GH007: would publish a private email, go to Settings → Emails, disable "Keep my email addresses private," then push again.


Step 7: Bring back stashed work (only if you used git stash in Step 2)

git stash pop

Step 8: Check GitHub

Open your profile. The squares should fill in within a few minutes (up to ~1 hour). Mine show up immediately.
Go into Settings → Emails → Enable "Keep my email addresses private".


Important to remember

  1. --force overwrites history. It is safe to do this on a repo only you push to, but it is very dangerous to do this on a shared repo.
  2. Never delete the verified email or the squares vanish again. You can add other emails freely.
  3. To stay private going forward, commit with GitHub's noreply email (find it under Settings → Emails — it looks like 12345678+username@users.noreply.github.com):
git config --global user.email "12345678+username@users.noreply.github.com"
You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
other General topics and discussions that don't fit into other categories, but are related to GitHub Question Ask and answer questions about GitHub features and usage
5 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.