Here's what I did to hook up my work computer to attribute commits to my personal Github account.
Assumptions:
If you're following along I'm going to assume you've set up an SSH key to enable pushing / pulling from your second computer.
Dependencies:
A suitable test repo — I cloned my sadiejay/sadiejay repo to test commit and preview the author field.
Documentation:
I then used this blog post to set up my GPG Key.
Github documentation for additional reference.
Steps:
Once I installed the GPG command line tool I followed the prompts.
For macOS, or at least my GPG cli, prompted to input your "Real Name"
I believe "Real Name" corresponds to your Github name NOT username.
For example, my name
is Sadie
. However, username
is sadiejay
.
For email use whatever is by your name in your commit history. I made sure to use my no-reply
address provided by Githbub. Check note under step 8
And that should work once you generate and input your key into Github.
Help I messed up I didn't change the automatically configured committer info
You can edit your gitconfig file with git config --global --edit
after you've made a commit on your local computer.
From there you can either
git rebase -i
and cherry pick which commits needs changing, thengit commit --amend --reset
if you've pushed to remotegit commit --amend --reset author
if you haven't pushed to remote.
Conclusion + Note
In addition to having the GPG key, having the git config
file match the github name and email is the main takeaway, email alone DID NOT work for me on the M1 pro.
I don't know what would happen if I need to change my email to make work email domain.
If I'm missing something or someone can explain what the GPG key is I'm all ears.
This could be all wrong and I just got lucky, but hopefully my lucky instructions help you too 😅
Acknowledgements
- WIT community members for illuminating the connection of the GPG Key to the contribution graph
- Virtual Coffee community members for helping me through vi, git rebase, and cluing me to the config file set up discrepancy
Top comments (0)