Dropbox中的未同步Git存储库 [英] Unsync'd Git Repository in Dropbox
问题描述
我有一个存储在我的Dropbox中的git仓库(和工作目录),所以我可以在计算机之间来回移动,而无需提交或存储(阅读:无需任何努力)。这很好,除了一个小麻烦成为一个主要烦恼。
每隔一段时间,我都会让一台电脑处于完全提交状态,在另一台计算机上,发现 git status
报告了更改。这些更改不可避免地与权限相关。我不确定的是为什么?我认为它可能与Dropbox如何在同步计算机上写入文件有关,但两个系统上的 umask
都设置为0002.我认为该值决定了模式由Dropbox编写/更新的文件,但这不会是我第一次出错。
我知道我可以告诉Git忽略文件模式,但这只是掩盖了问题。我真的很想了解它,所以我可以做出明智的决定如何进行。
谢谢。
UPDATE
因此,这是一个相当不错的代表性示例,即使它完全包含在Dropbox中,也不会出现同步。正如我们所说,我的个人笔记本电脑正在为我的一个项目报告一个干净的工作目录:
$ git status
#在分支上开发
无需提交(工作目录清理)
我的工作笔记本电脑,会报告一些未跟踪的文件。让我再说一遍:未跟踪 文件。
$ git状态
#在分支上开发
#未记录的文件:
#(使用git add< file> ...来包含将要提交的内容)
#
#html / cake / console / libs / templates /
#... 4个文件...
#html / cake / tests / test_app / plugins / test_plugin / views / themed /
没有添加任何提交但未跟踪的文件存在(使用git add跟踪)
这怎么可能是?我的〜/ .gitignore
文件也在两台机器间共享(不是任何这些路径都被忽略在忽略文件中)。是否还有另一个Git组件 - 或者Dropbox--可以在这里使用? 我已经得到了这个在相同的情况下确切的问题。
要停止显示 git status
中的文件,您可以将git设置为忽略文件模式更改:
git config core.filemode false
这个改变对于git仓库是本地的,并且会与文件同步。
I have a git repository (and working directory) that is stored in my Dropbox so I can move back and forth between computers without having to commit or stash (read: without any effort at all). This is working great except for one minor annoyance that is becoming a major annoyance.
Every so often, I'll leave one computer in a fully committed state only to pick up on the other computer and find that a git status
reports changes. Inevitably, those changes are related to permissions. What I'm not sure about is why? I assumed that it might be related to how Dropbox writes files on sync'd computers, but the umask
on both systems is set to 0002. I would assume that value dictates the mode of files written/updated by Dropbox, but it wouldn't be the first time I'd be wrong.
I know I can just tell Git to ignore the file mode, but that's just masking the problem. I'd really like to understand it so I can make an informed decision of how to proceed.
Thanks.
UPDATE
So here's a pretty decent representative example of a repository getting out of sync even though it's entirely contained within Dropbox. As we speak, my personal laptop is reporting a clean working directory for one of my projects:
$ git status
# On branch develop
nothing to commit (working directory clean)
My work laptop, though, reports a number of untracked files. Let me say that again: untracked files.
$ git status
# On branch develop
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# html/cake/console/libs/templates/
# ...4 more files...
# html/cake/tests/test_app/plugins/test_plugin/views/themed/
nothing added to commit but untracked files present (use "git add" to track)
How can that be? My ~/.gitignore
file is also shared across both machines (not that any of these paths are excluded in an ignore file). Is there another component of Git--or maybe Dropbox--that could be in play here?
I've gotten this exact problem under the same circumstances.
To stop the files showing in git status
you can set git to ignore file mode changes:
git config core.filemode false
This change is local to the git repository and will be synced along with the files.
这篇关于Dropbox中的未同步Git存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!