Are you a ghost producer on GitHub?
Collaborator on a repo but don’t see your name show up in the contributors graphs? Same! Read on for a possible solution.
Hop into your terminal and run this command:
Did it spit out a bunch of directories? Is your .gitconfig/ directory missing from this list? If you answered “yes” to both of these questions…
you need to get your Git configuration sorted out!
GitHub kindly provides some assistance with getting your Git configuration set up for future projects. In my case, I followed the instructions for setting every repository on my computer (global). Run the same command as above. You should see something like Users/jdoe/.: Is a directory. Woo! That means your gitconfig exists now. Just to double check, run this command:
In the output, you’ll see your Git configuration settings such as your name and email listed. But what about my previous repos and projects on GitHub? Glad you asked, champ. Onward to the next step!
Fork the repos you want to alter then hop over to your terminal. Make a new directory, cd into that ishh, and git clone. cd into that repo and confirm you are working off a fork with git remote -v. Good? Good. Do a git log and see what information is associated with your commits. In my case, the email was some WTFBBQ nonsense: <email@example.com> Now for the real business (!important)…
Add (touch) a file called rename.sh to a directory or location of your choosing. Personally, I just added the file to the repo I was currently working in. Open rename.sh with the text editor of your choosing (I am partial to Atom ❤). Now, add this code to the file:
Delete where it says “OLD_EMAIL…” and paste in the WTFBBQ email from your git log commit history. Likewise, delete the “new-email…” placeholder and add your desired email address. Here’s what mine looked like after swapping:
Save the file. You’re almost done, hooray! Back in your terminal: run the command bash rename.sh and you should start seeing a bunch of files with “…was rewritten” appended to each one. Wait for it to finish doing its thang and do another git log to verify that your email address changed successfully. Are your commits now displaying the correct information? Sweet.
But wait, there’s more! One last step before you crack open a celebratory La Croix: git push -f origin master to update your repo on GitHub and you’re all set.