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

心已入冬 提交于 2020-01-11 06:15:13

问题


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?


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/17251155/how-to-use-git-with-dropbox-and-a-usb-stick-thumbdrive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!