Create Git repository on Google Drive/Dropbox

Setting up a single-user Git repository on private cloud storage is not difficult and incurs no cost to you.

Motivation

I wanted to create a source control repository and Git seemed like the best choice nowadays. I do not want to keep my data on public repositories yet I want data to be stored on the cloud for backup. You do not need to setup a web server unless you want multi-user support.

The solution

Create Git bare (I will describe reasons for using bare repo below) repository on Google Drive. You could use Dropbox or other cloud storage that you favour.

Git bare repository on cloud storage

When compiling project, lots of file get created/updated/deleted and this causes frequent syncing to cloud. Furthermore, after using for a while my Git repository became corrupted. Therefore, I strongly discourage using cloud storage synchonised folder as working folder.

Instead, create a Git bare repository on Google Drive. A bare repository disallows you from working on it but you could clone/push from/to it.

  1. On Windows, I recommend installing TortoiseGit.
  2. Open Google Drive/Dropbox folder and create a Git folder.
  3. Open the newly created folder.
  4. Right click and choose Git Create repository here, tick Make it Bare.

Cloning repository to working folder

  1. I recommend creating under your Documents (i.e. C:\Users\<user>\Documents\Git) folder. Navigate to Documents folder.
  2. Right click and choose Git clone. The source path is your Git folder on Google Drive/Dropbox. The destination path is your Documents\Git path.

Adding files to working folder

  1. Drop any files/folders into the working folder.
  2. Right click on the files/folders then choose TortoiseGit > Add. Note that you need to commit your changes before they actually get into your working folder’s Git repository.
  3. To commit the addition, right click and choose Git Commit -> "master".

Push working folder changes to cloud storage

Right click on working folder then choose Tortoise Git -> Push. The remote folder should be pointing to the origin already.

Your cloud storage should now have the changes.

Support Me

If this post helped you, would you buy me a cup of tea/coffee?