12 April, 2022

Technical blog: Managing Google Earth Engine repositories using Git

A technical blog from Data Scientist Yvonne Fong. 

Earth Engine scripts are stored in Git repositories hosted by Google. You can browse all repositories to which you have access by going to earthengine.googlesource.com, or browse repositories that you own by going to earthengine.googlesource.com/users/USERNAME.

Google git

Since Earth Engine repositories can be accessed using Git, you can easily download repositories from Earth Engine, manage and edit your scripts outside the Code Editor, and then push the scripts back into Earth Engine again.

You may want to do this so as to move repositories from one account to another, keep a copy on your local drive, or to streamline team collaboration on platforms such as GitHub.

What is Git?

Git is an open source distributed version control system. It is how Earth Engine maintains a full version history of all scripts and repositories so users are able to compare or revert scripts to an older version.


Outside of the Code Editor, using Git to work on scripts also allows for non-linear workflows on multiple branches so different users can work on separate copies of the code, then merge and push it back into the remote repository in Earth Engine.

The quickest way to get started on Git is to download it here. NB: If you are working on a Windows system, you will need to use GitBash as your terminal to run Git commands. 


Cloning repositories from Earth Engine

To clone a repository from Earth Engine, navigate to the required repository at earthengine.googlesource.com and copy the code snippet at the top of the page into your terminal.


The same code snippet can also be found in Code Editor by hovering over the required repository and clicking on the settings icon.

share repo


Start your terminal and run the following to clone the repository from Earth Engine to your local drive.

git clone https://earthengine.googlesource.com/users/USERNAME/REPOSITORY

You can now manage your scripts locally and/or push it into somewhere else like a different Earth Engine account, or GitHub.


Pushing scripts into Earth Engine

Pushing scripts back into Earth Engine can also be easily done using Git.

In your browser, go to https://www.googlesource.com/new-password and copy the code generated into Git Bash to configure Git and authenticate to Earth Engine.

Add the Earth Engine repository you want to push scripts into as a remote connection.

git remote add ee https://earthengine.googlesource.com/users/USERNAME/REPOSITORY

It is important that the local branch where your scripts are stored is named ‘master’, otherwise Earth Engine will not recognise the path. Run the following command to change the current branch name, replacing currentname with the name of your branch.

git branch -m currentname master

Push the scripts from your local branch to the Earth Engine repository added as a remote connection earlier.

git push -u ee master


Things to note

One thing to note is that Git is not able to parse folders within an Earth Engine repository, so ensure that all your scripts are in the root repository and that there are no folders in there before attempting to clone the repository.



Whether it’s wanting to move repositories from one Google account to another, keep a copy of scripts locally or collaborate on scripts with others outside of the Code Editor, hopefully this short blog has helped you out. Our team of data scientists are accomplished Earth Engine users and are always looking for more talent. If you are interested in working with us, see our vacancies here

If you or your organisation needs assistance with a project, please contact us via the Contact form.

Back To News Stories

Connect with us

Our office
Eastpoint Plaza, Suite 5.01, Level 5, 233 Adelaide Terrace, Perth WA 6000, Australia