Transferring Github stars 🌠

I recently changed the name of one of my projects and it dawned on me: it's probably possible to transfer Github stars! I tested this theory and found it to be true.

After pouring lots of love into my new project brownies of course it had no stars. But one of my I can hack that in an hour repos got to the front-page of Hacker News and got a bunch of undeserved stars:

Since the new project is a strict extension of the old one, I decided to go ahead and try to reverse the star count. Let me explain how I did it and the dangers below.

I believe I'm not breaking any Github ToS, but I am not a lawyer and this is not legal advice.

Prepare for the shooting stars

The first thing to do step is to rename the repositories:

brownies → cookies

cookies.js → brownies

Now we have the right names with the right amount of stars, but the repositories do not have yet the right content. Since my local project brownies already points to the right repository, let's try to push:

$ cd ~/projects/brownies
$ git push origin master
To github.com:franciscop/brownies.git
! [rejected] master -> master (fetch first)
error: failed to push some refs to '[email protected]:franciscop/brownies.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

As I guessed, it doesn't work since the histories are not compatible. Since I backed up everything and I use Git mainly as a tool to deploy, let's just force it:

Dangers

What if you are a big corporation and want to publish a new package, but don't want it to look empty?

While there are some shady services to buy fake Github stars, with this exploit a company could just pay someone and get their repository with real user stars. If this became popular, I can see people faking up repos only to sell them, and we'd end up in a very bad place (aham, twitter).

The fact that this is possible opens up to a new world of dangers, and unlikely a previous similar issue there does not seem to be a logical solution here from my limited external point of view.

Any solution at this stage might be worse than the problem, so my only recommendation for Github is to monitor transfers of repos with "high" star count for history changes and take manual action.

Fortunately the value of Github stars is still fairly limited for this to be a target now, but it seems like things might change in a future with too many repositories.

Why don't you try the library and let me know what you think? Or explore my site and say hi: