I. Preface

I’ve been working on some small projects that I can’t easily make public on GitHub, but I wanted to have a simple private repository.

So I came up with DropBox.

However, we couldn’t simply put the project in the DropBox directory, because that would cause every simple save to initiate a file sync, and some temporary file changes during compilation would cause the DropBox to sync, which would drive the CPU usage of the computer very high.

All we want is a remote repository.

So I came up with the Git init --bare command, tested it out, and it worked fine, so I’ll share it with you.

II. Methodology

  1. We’re going to manage the project with Git in the local non-DropBox directory as normal, and we’ll assume that this local project is already built.

  2. Synchronously, we’ll create a new corresponding synchronization directory in the DropBox directory, and in that directory, we’ll initialize it with git init --bare (see below). This command will only create an empty Git repository, with no workspace or cache.

  1. In the Git repository of your project, use the git remote add command to assign the repository you just created to a remote repository named origin (see the image below).

  1. Finally, run git push origin master to sync the code to DropBox.

  2. I took a look at the DropBox status and it quickly synced the code to the cloud.

  1. When we want to download this project on another computer, we just need this: git clone <DropBox repository directory> <local directory> and that’s it (the following picture).