I've switched my Git repositories to GitHub recently, and started to watch my contributions statistics, which were very low considering I spend my days hacking on open source software, especially OpenStack.
OpenStack hosts its Git repositories on its own infrastructure at git.openstack.org, but also mirrors them on GitHub. Logically, I was expecting GitHub to track my commits there too, as I'm using the same email address everywhere.
It turns out that it was not the case, and the help page about that on GitHub describes the rule in place to compute statistics. Indeed, according to GitHub, I had no relations to the OpenStack repositories, as I never forked them nor opened a pull request on them (OpenStack uses Gerrit).
Starring a repository is enough to build a relationship between a user and a repository, so this is was the only thing needed to inform GitHub that I have contributed to those repositories. Considering OpenStack has hundreds of repositories, I decided to star them all by using a small Python script.
!/usr/bin/env python from github import Github USERNAME = "myusername" PASSWORD = "mypassword" USERS = ("openstack", "stackforge", "openstack-dev", "openstack-infra") g = Github(USERNAME, PASSWORD) me = g.get_user() for username in USERS: user = g.get_user(username) for repo in user.get_repos(): me.add_to_starred(repo) print("Starred %s" % repo.full_name)
And voilà, my statistics are now including all my contributions to OpenStack!