How to set up Git on Google Compute Engine

This is a beginner level tutorial for setting up Git on a Google Compute Engine Virtual Machine.

When I develop an application I do it in an iterative process. The first peace I did for the Nodejs server on GCE was in my last blog setup nodejs on gce which leaves off with being able to browse to the server from an external browser.

The next needed steps that I intend are to add Postgress for the Database, the Express framework to handle the HTTP and I haven’t decided on Aurelia or PhoneGap yet for the front end framework. But, it would be horrible to setup everything and then lose it. There are 2 steps that will aid in this.

1. Is to create version control so all the files live on Git.
2. The second is making a bash script that sets up and installs all the packages so I could easily get started from scratch in a fresh Ubuntu install, that file would also live in the Git repo.

This post will detail setting up Git. It’s really the same on any Ubuntu server, mine just happens to be on a Google virtual machine.

All there is to it:

sudo apt-get install git

The next step is to enter the username and password. Since this is on a Virtual Machine I don’t want to use my personal Git Account. I’ll make a new one for the project. You can get an free account if you don’t mind it being public. Sign up at, github.com

Now, It’s great if your developing your app and you push your changes up to GitHub so other collaborators can get them, and fetch changes others made and pull them down. But, that doesn’t make as much sense when it’s a webserver. It would be a pain to need to log onto the virtual machine hosting the webserver and pull down the changes. Setting up Automatic Deployment is the answer.

Here’s a link to instructions for it:

If you want to work on the VM like it was your local dev environment, especially at the start that’s fine also.

Set up your user name next.

git config --global user.name "Your Name"
git config --global user.email youremail@example.com
Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *