Should I keep my Git folder outside Dropbox?

2019-02-03 11:03发布

问题:

So far I've managed my code by keeping it inside my Dropbox folder and nothing more. Lately my code has been growing in size and complexity and I'm wondering if it wouldn't be better to set up a GitHub or Bitbucket account to manage it more efficiently.

I know there are already dozens of questions here regarding all kinds of mixes between Git and Dropbox; this is precisely what got me confused. Some say it's a great idea while others say it's a terrible idea.

I just want to know: if I decide to set up a git repository, using either GitHub or Bitbucket, should I move my .git folder outside of my Dropbox folder?

回答1:

Yes, it is important to keep your Git folder outside of Dropbox.

Dropbox can sometimes get confused and create a lot of duplicates of your files, such as filename~(conflict), which can really mess up your Git repository and require time to clean up.



回答2:

In fact, if you are using GitHub or another public Git hosting service, you should not put your Git repository in Dropbox at all. It makes almost no sense (to me, at least) since with GitHub you can already access your code anywhere, as long as you have internet access.

The situation is totally different in your link, which considers that Git on Dropbox is a great idea. Since he uses only Git without a public Git server, he just uses Dropbox as a central git repository which acts as something similar to GitHub.

Think twice about the differences between using Git and using Github and the purpose of using Github and Dropbox together.

As to your question, Yes, you should keep your .git folder outside the Dropbox, as Leon suggested. Besides the reason he gives, which is the most important, there is another reason: the .git folder can grow quite large and might occupy a significant amount of your Dropbox's total space.

Meanwhile, moving your Git repository completely outside of your Dropbox is strongly recommended.