c_ern
c_ern

Reputation: 151

How to use git with dropbox and a usb-stick/thumbdrive

As I am relatively new to git, I hope to get some jump-start on how to use git in my configuration:

Background

I'm writing my bachelor's thesis in mechanical engineering and work both at the university and at home.

The thesis itself is a .docx file (no TeX allowed) with some .xls-files and pictures in subfolders alond with a subfolder including all of the relevant literature which alone takes 1.5 gigs of space.

Configuration

At home, I have a desktop and a laptop, both have internet access. At the university, I use a pc with - i would say - flaky internet access.

So I would like the files on all my computers to stay in sync.

Current Situation

At the moment, I use dropbox to hold all of my files und sync both computers at home, while using a usb stick and some robocopy-batches to sync the files on my pcs at home with the one at the university.

Goal

Now I would like to use git and would like to know how to set up the repositories best. E.g. where to put the central repository, how to use the usb stick...

I think github as a central repository is out of the question as it has a quota of 1gb per repo.

Can I still use dropbox or does it break the files in the repository?

Upvotes: 3

Views: 1481

Answers (2)

VonC
VonC

Reputation: 1326716

Dropbox can work, but I wouldn't recommend it for synchronizing a full git repo (too many files to synchronize).

However, it can synchronize very easily one file.
In git lingo, a git bundle.

As explained in "How to synchronize two git repositories", you can save the content of a local git repo into one file (located in your Dropbox folder).
And on your second machine, you can clone or fetch from that one file (updated by dropbox).

Once created, you can incrementally update your bundle, adding all new branches and tags.

Upvotes: 3

Erik Sommer
Erik Sommer

Reputation: 67

I wrote my bachelor's thesis under the same circumstances. Both of your planned ways should be possible and work with the same workflow.

I suggest you the way with the usb stick, because the syncing of the dropbox can cause problems with the git command right after the boot one of your computers.

So now the workflow:

Iinitiate a git repo on one of your computers, where your files are located in the folder where your files are.

git init

then clone a bare repo to your usb stick.

git clone --bare firstinitfolder

now there is a bare repo on your usb stick, like on a server. You can sync the both other computers with the stick.

git clone usbstickfolder

So all computers are in sync and versioned.

Beware of some common mistakes:

  • make sure that the usb stick is always boot with the same drive letter (I suggest you use a windows system). This would be an advance of Dropbox.
  • when you working with branches push always all of them to the stick

Upvotes: 3

Related Questions