Go to content

Alexander Skogberg

UX / UI Designer

UX / UI Designer who digs design systems, accessibility, loud rock music, and adventure trips

Using Dropbox as a backup Git repository


When working on solo projects, both at HiQ and on my spare time, I tend to use Git for version control.

Git logo.

I always put the repository on Dropbox for easy backup. This is quite easy if you’ve worked with Git before, but probably not for a total newbie. This tutorial is for all you newbies :)

Here we go!

Step 1: Create a folder for your Git repositories in your Dropbox folder

First, create a new folder in your Dropbox folder. This one will hold all of your repositories. I’ve chosen to call mine GitRepos.

Step 2: Initialize a repository for your current project in a subfolder

Start Terminal in OS X and follow these two steps:

1. Go to your, already created, repositories folder in your Dropbox folder.

$ cd ~/Dropbox/GitRepos/

2. Create a subfolder and initialize the repository (second line is Terminal output).

$ git init --bare demo
Initialized empty Git repository in /Users/Skogberg/Dropbox/GitRepos/demo/

Step 3: Initialize a repository in your project folder

I usually put my projects in the default Sites folder in OS X and set up my repository with these four steps:

1. Go to your projects folder.

$ cd ~/Sites/

2. Create a folder for the new project.

$ mkdir demo

3. Go to the folder you just created.

$ cd demo

4. Set up the repository.

$ git init
Initialized empty Git repository in /Users/Skogberg/Sites/demo/.git/

Step 4: Set up a shortcut to the Dropbox repository

This will make step 5 much smoother.

$ git remote add demo ~/Dropbox/GitRepos/demo

Step 5: Add some files and make your first commit

Let’s say I’ve placed a JPG file named cheezburger.jpg in the project folder. Let’s commit it and push it to the repository on Dropbox with these steps:

1. Add all the new files to the index for the upcoming commit.

$ git add --all

2. Commits the changes with a message explaining the commit.

$ git commit -m "First commit."
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 cheezburger.jpg

3. Push the changes to the Dropbox repository. Note the demo shortcut created in step 4.

$ git push demo master
Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 29.17 KiB | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /Users/Skogberg/Dropbox/GitRepos/demo
 * [new branch]      master -> master

Note: Every other time, you must make a pull request before making a push.

$ git pull demo master
From /Users/Skogberg/Dropbox/GitRepos/demo
 * branch            master     -> FETCH_HEAD
Already up-to-date.

And you’re done! Nice, huh?

If you want to learn more about using Git, I’d highly recommend giving git – the simple guide – no deep shit a look. If you’ve got fifteen minutes, try the interactive online tutorial Try Git: Code School by Github.

If you run into any troubles with my tutorial, have a look at Using Dropbox as a Private GitHub by Jimmy Theis (@jetheis). He explains the same thing, but in greater detail and with solutions to common issues.

Anything I left out and should learn (probably a lot)? Let me know in the comments section below!

/Alex

Much responsive Many CSS Very breakpoint So media query Such HTML Wow