Author’s note

This post was recovered from my old blog via the Wayback Machine. Ten years later, I think this probably still works.

@jbnunn

25-Sept 2022


Using Google Drive as your personal Git repo - Aug 25 2012

GitHub is a great tool, but sometimes you need a private Git repository and don’t want to have to cough up the extra $$ per month for that. Enter cloud storage. You can get this lots of places now: Dropbox, Amazon Cloud Drive, and Google Drive to name a few. You can take advantage of your free space to store your private repos with just a few simple steps. This process will work the same on the sites just mentioned, but these instructions are specific to Google Drive. Open your Terminal to get started:

  1. Go to your project’s directory and “git init” to init a new repo.
  2. Add any untracked files with “git add .”
  3. Commit those files with a message using “git commit -m ‘Your commit message’”
  4. We’re now going to use our Google Drive and create a blank repo. First, make sure Google Drive is running. Then, open Terminal, and

Create a new, blank project with

git init –-bare ~/Google\ Drive/git/myproject.git

Be sure to change myproject to whatever your git repo’s name will be.

Add the origin to your project with

git remote add origin ~/Google\ Drive/git/myproject.git

Your origin is now set, meaning you can now push with

git push -u origin master

(on future pushes, you can just “git push” without the “-u origin master”)

That’s it – you can verify it worked by going to a new directory and trying to clone your project

cd /tmp
git clone ~/Google\ Drive/git/myproject.git

and you’ll see it clone your repo into a new folder.

- @jbnunn