Oh, did you mean that to be a PRIVATE repository?

A web developer from South Africa said a bug in a tool for using Microsoft's Visual Studio IDE with code-sharing site GitHub inadvertently exposed his sensitive data – and the error cost him more than $6,500 (£4,250) in just a few hours.

Carlo van Wyk of Cape Town–based Humankode said he used the GitHub Extension for Visual Studio 2015 to commit one of his local Git code repositories to a private repository on GitHub.

Unfortunately, however – and unknown to van Wyk at the time – a bug in the extension caused his code to be committed to a public GitHub repository, rather than a private one as he intended.

The extension is developed and maintained by GitHub itself, although it was created with a little help from Microsoft. Van Wyk said in his blog post that both companies have since been in touch with him and the bug has been confirmed and patched.

But that won't help mitigate the fallout of what happened after van Wyk committed his repo.

Within around ten minutes after publishing his code, he received a notification from Amazon Web Services telling him his account had been compromised. He had (somewhat foolishly) included an AWS access key in the code that he had committed to GitHub.

It's not entirely clear what happened next. Van Wyk said he immediately changed his AWS root password, revoked all of his access keys, and created new ones. Nonetheless, within hours the data thieves had managed to sign him up for AWS's Elastic Compute Cluster and fire off more than 20 instances in each EC2 region.

By the time the dust cleared, his AWS account had racked up a bill of $6,484.99.

Such cases aren't new. Miscreants – probably Bitcoin miners, in most cases – have begun routinely trolling public GitHub repositories with bots that search for AWS keys. In van Wyk's case, however, he never expected his repo to be public in the first place.

AWS has not responded to TheReg's request for comment on the matter as we push the big, red "Publish" button on this story.

GitHub, on the other hand, has apologized for the error in its code, describing it as "inexcusable."

GitHub team member Phil Haack added, "As for preventing this in the future, we are trying to take a comprehensive look at the conditions and systems that allowed this happen in the first place and how we can improve those systems to mitigate such issues in the future."

If you'd like to get the patched version of the GitHub Extension for Visual Studio, you can download it here or get it using Visual Studio 2015's internal update mechanism. ®