Last Updated: February 01, 2019
· jjperezaguinaga

Add your geolocation to Git every time you commit

A couple months ago, Github released a Mapping geoJSON feature, allowing them to parse any .geojson files you have in your repository as maps and easily add them in your website. The maps looks something like this


In this article, I'll show you how to add your geolocation in your repository (and of anyone that wants to share it) every time you perform a commit. This can give as a result a colorful combination of cities and countries that you can showcase in your repository.


1) Install Geomit. It's a chrome packaged app that retrieves your geographic location through HTML5 and creates a listening TCP server on localhost:8888*.

2) Run Geomit. You will see two windows, one with the Geomit listening message and one with the Pre-commit Hook instructions. Click on the "Copy Pre-commit Hook" button.

3) Paste the pre-commit hook into any repository you want to add a contributors.geojson. Since I use sublime, I usually do the following.


4) Continue working as you would. When you commit, Geomit will add a contributors.geojson to your repository, or just add your geolocation to it if there's an existing one. Be aware that your repository needs to have a remote origin branch to retrieve your username.

*<small>Disclaimer, I'm the creator of Geomit. Feel free to see the source code on Github, fork or do anything you want with it</small>.


You might had stumbled upon projects like Jquery, Prototype, RaphaelJS, Backbone, AngularJS, Foundation, Twitter Foundation, etc. All of them had been created through many iterations from multiple developers. I had always wondered... where are those developers? From which countries? Is there any way we can say "thank you" with something more than just a "contributors.md"? After Github's Map parsing contributors.geojson came to my mind.

It's also a proof of concept. The fact that a browser extension can create a TCP server, transfer files and tag your geographic location is mind blowing. That was impossible just a few years ago.

Security and Privacy

This project is solely an effort to bring recognition to people all over the world in a more "personal" way. This can only be done by people that is willing so; if no one uses it, no one can see anyone's location.

However, you should be aware that the accuracy your browser location has is scarily good. You are technically tagging your exact location to a possible public space browsable by anyone. There's no login, no anything. Your Github username, your location and the previous SHA of your commit is attached in a file form now on.

By no means you should share your location if you feel uncomfortable doing so, specially in a open source webpage such as Github where it's store in a historical fashion. You can see more details of the technology in the Github page.

4 Responses
Add your response


Hi Jose, thanks for sharing this!!! I am a little obsessed with geolocation related stuff... and I just created my own resuem/profile thing with geolocation: https://coderwall.com/p/1zx9ha, this could be another feed that I will consider integrate. :)

over 1 year ago ·

Cool! Best of lucks :) There has been many improvements on Geolocation over the last years. I think the coolest/scariest part is the fact that you can get a user Geolocation with the proper permissions without asking him/her again on a chrome extension. Maybe should you could use in the future for your projects.

over 1 year ago ·

This is very cool but I was unable to get it to work on my Windows machine.

When I run a commit I get...
basename: too many arguments
Try `basename --help' for more information.

over 1 year ago ·

@jasondavisfl Sadly I'm not positive it can work on a Windows machine... #!/usr/bin/env ruby. Do you have something like cygwin working on your computer? Are you able to run Ruby?

over 1 year ago ·