1

I have two remotes for a git repo. One of the remotes is at Bitbucket and the other is at GitHub. Now, I will always push/pull to/from the bitbucket repo and only push to the GitHub repo (You can consider it a backup). While pushing my changes, I want to use different email addresses for both remotes. I've searched much on the internet but didn't find this specific use case. Is this possible? Please let me know about the necessary configurations to achieve this. TIA

Junaid
  • 85
  • 8
  • 2
    The commit email cannot be changed by pushing. Why would you want that? – Sergey Kuznetsov Mar 03 '23 at 05:28
  • 1
    That's not possible. The e-mail is part of the information put inside each commit so you will have to rewrite them and have 2 different branch histories. It seems strange. What is the goal you want to achieve? – Philippe Mar 03 '23 at 07:39
  • 1
    If it's a backup in Github, maybe you can put the repo as private so you don't care any more the email used to commit as it will never be visible by anyone... – Philippe Mar 03 '23 at 07:42
  • @Philippe: GitHub is not showing my commits history on the contribution graph. Upon searching I found out that it is happening because the email linked with my GitHub is different than the one I am using to push my changes to GitHub remote repo. So, I want to push changes to the GitHub remote with the same email address, which will count my commits on the contribution graph. Please educate me too if the reason I mentioned above that why my commits don't show on the contribution graph is correct or not. – Junaid Mar 03 '23 at 09:08
  • 1
    Your best option to see the commits in your contribution graph is to add this email address as a Seco on email address in your github account settings. See https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-settings-on-your-profile/why-are-my-contributions-not-showing-up-on-my-profile – Philippe Mar 03 '23 at 17:41

1 Answers1

0

GitHub is not showing my commits history on the contribution graph.

Upon searching I found out that it is happening because the email linked with my GitHub is different than the one I am using to push my changes to GitHub remote repo.

So, I want to push changes to the GitHub remote with the same email address, which will count my commits on the contribution graph.

You would need to rewrite the history of the fetched repository in order to change the email associated with past commits, and push them to GitHub with your GitHub account email.

That would not be practical, since the fetched history from Bitbucket would still be with the old email.

You could try and add your Bitbucket email to your GitHub account emails, and, from the documentation:

Commits will only appear on your contributions graph if the email address you used to author the commits is connected to your account on GitHub.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250