Git is really great at distributed development and workflows. When you set up git, it asks you for your name and email address. From then on, all your commits to all the projects you work on from that machine are tagged as you.
But sometimes you don’t want to be you. Existential commentary about becoming someone else aside… maybe you want to donate your code anonymously to an open source project, or publish some code that has legal issues or you simply don’t want attributed to you.
How do you become someone else temporarily? You can always pass the _–author="Someone Else firstname.lastname@example.org"_ parameter to git-commit and it’ll appear as though you’re that new person. However, git still knows that you’re you and it sets a "Committer" property in the history which completely defeats what we’re trying to do here. That simply won’t do. We’ve got to find a better solution.
First things first: if you’re really paranoid about people finding out that you’re the committer, sign up for a private VPN service so that you can anonymize your web traffic. This will make it so that google, github, and others can’t associate your IP address with another account. My favorite VPN is Mullvad, and at €5 a month, it’s a bargain for anonymous browsing (on up to 3 devices at a time!).
After your internet traffic is properly anonymized, sign up for a free email account somewhere and a new github account – make sure to do this from a blank virtual machine or a browser you don’t ever use (Safari and Firefox get little use on my system, so I just fired one of them up).
Now it’s time to change that committer name. We can always tell git to rewrite the repository history (github has a nice little script that we can modify to fit our needs, or wade through a myriad of other solutions on stackoverflow), but I’ve found that the easiest way to prevent this from happening is to simply change your local configuration of that particular git repository before you commit the changes – because honestly, if you’re worried about anonymizing your commits, you should be planning ahead. If you’re in the terminal, just cd into the directory and run two commands to tell that particular clone who you want to be!
git config user.name "Someone Else" git config user.email "email@example.com"
From now on, it won’t set that "committer" parameter in the history and you can work with other repositories as yourself since you didn’t pass the –global option when changing the user properties. It just changed your identity for that particular repository.
You can even push it up to github and everything stays anonymized. Just remember that if you use your primary SSH keys, your other username may show up as adding the commits…
So make sure you use basic authentication or switch out your ssh keys when pushing up to github. The easiest way is to set the remote url to the "https://" url option (instead of git@ or git://) and when pushing, specify the username you want to use like so:
git push -u [other_user_name] master
You’ll be prompted for that account’s password and can push up the changes as that different person. If you don’t want to specify the username all the time in your push commands, you can modify the URL of the git repos to be