Git和Dropbox可以一起使用吗?
当前回答
我们在共享文件夹上使用这种方法(在Dropbox中创建一个裸存储库)。
一小组开发人员可以从这个完全同步的存储库中提取数据,并创建一个本地克隆。一旦单位的功完成了,我们就回到原点。
我缺少的一件事是,在推送到原点时发送带有更改集信息的电子邮件的好方法。我们使用谷歌Wave来手动跟踪更改。
其他回答
这个答案是基于Mercurial的经验,而不是Git,但这个经验告诉我们,如果你在不同的时间从不同的机器(对我来说是Mac、Unix和Windows)更新相同的基于Dropbox的存储库,那么以这种方式使用Dropbox会导致存储库损坏。
I don't have a complete list of the things that can go wrong, but here's a specific example that bit me. Each machine has its own notion of line-ending characters and how upper/lower case characters are handled in file names. Dropbox and Git/Mercurial handle this slightly differently (I don't recall the exact differences). If Dropbox updates the repository behind Git/Mercurial's back, presto, broken repository. This happens immediately and invisibly, so you don't even know your repository is broken until you try to recover something from it.
在用这种方法解决了一次混乱之后,我一直在使用下面的食谱,而且非常成功,没有任何问题的迹象。只需将存储库移出Dropbox。其他事情都用Dropbox;文档,JAR文件,任何你喜欢的东西。并使用GitHub (Git)或Bitbucket (Mercurial)来管理存储库本身。这两种工具都是免费的,所以不会增加成本,而且现在每种工具都发挥了自己的优势。
在Dropbox上运行Git/Mercurial除了风险什么都不会增加。不要这样做。
我把我的非github回购存储在Dropbox上。我遇到的一个警告是重新安装后的同步。Dropbox会先下载最小的文件,然后再下载较大的文件。如果你从晚上开始,周末后再回来,这不是问题:-)
我的帖子- http://forums.dropbox.com/topic.php?id=29984&replies=6
正确的方法是使用git-remote-dropbox: https://github.com/anishathalye/git-remote-dropbox
在Dropbox中创建自己的裸回购会导致很多问题。Anish(库的创造者)解释得很好:
The root cause of these problems is that the Dropbox desktop client is designed for syncing files, not Git repositories. Without special handling for Git repositories, it doesn’t maintain the same guarantees as Git. Operations on the remote repository are no longer atomic, and concurrent operations or unlucky timing with synchronization can result in a corrupted repository. Traditional Git remotes run code on the server side to make this work properly, but we can’t do that. Solution: It is possible to solve this properly. It is possible to use Git with Dropbox and have the same safety and consistency guarantees as a traditional Git remote, even when there are multiple users and concurrent operations! For a user, it’s as simple as using git-remote-dropbox, a Git remote helper that acts as a transparent bidirectional bridge between Git and Dropbox and maintains all the guarantees of a traditional Git remote. It’s even safe to use with shared folders, so it can be used for collaboration (yay unlimited private repos with unlimited collaborators!). With the remote helper, it’s possible to use Dropbox as a Git remote and continue using all the regular Git commands like git clone, git pull, and git push, and everything will just work as expected.
在不使用第三方集成工具的情况下,我可以稍微改善一下条件,并使用DropBox和其他类似的云磁盘服务,如带Git的SpiderOak。
我们的目标是避免在这些文件修改的中间同步,因为它可以上传一个部分状态,然后下载回来,完全破坏你的git状态。
为了避免这个问题,我做了:
使用git Bundle create my_repo将我的git索引捆绑在一个文件中。git——所有。 为文件监控设置一个延迟,例如5分钟,而不是瞬间。这降低了DropBox在更改过程中同步部分状态的机会。它在动态修改云磁盘上的文件时也有很大帮助(比如即时保存笔记应用程序)。
它并不完美,因为不能保证它不会再次弄乱git状态,但它有帮助,目前我没有遇到任何问题。
还有一个开源项目(一个跨平台[Linux, Mac, Win]脚本的集合),它用少量(3-4)命令完成存储库管理的所有细节。
https://github.com/karalabe/gitbox/wiki
示例用法如下:
$ gitbox create myapp
Creating empty repository...
Initializing new repository...
Repository successfully created.
$ gitbox clone myapp
Cloning repository...
Repository successfully cloned.
之后正常的git使用:
$ echo “Some change” > somefile.txt
$ git add somefile.txt
$ git commit –m “Created some file”
$ git push
查看项目wiki和手册以获得完整的命令参考和教程。
推荐文章
- 将文件的当前工作副本与另一个分支提交的副本区别对待
- 配置Git接受特定https远程的特定自签名服务器证书
- 如何将一个特定的提交从一个分支合并到Git中的另一个分支?
- 通过SSH配置Git登录一次
- 从pull请求中删除一个修改过的文件
- 如何使用Git恢复
- 如何提交没有变化和新的消息?
- 找到Git分支创建者
- 下载GitHub项目的最快方式
- git索引到底包含什么?
- 以树形输出git分支
- 如何点Go模块的依赖在Go。Mod到回购中的最新提交?
- 为什么调用git分支——unset-upstream来修复?
- Windows git“警告:LF将被CRLF取代”,这是警告尾巴向后吗?
- git中的哈希冲突