Github repo cloned to synced iCloud drive on multiple computers

大兔子大兔子 提交于 2020-04-10 03:24:22

问题


I have a couple of Macs onto which I clone a fair number of git (mostly GitHub) repos. The Macs each have a number of iCloud drive synced directories (in fact I've gone all-in and am syncing Desktop and Documents).

I have tried to clone into the iCloud-synced directories. However, I have been having lots of problems with this. It seems very easy to get into a condition where iCloud (not git) gets so confused that one machine effectively stops syncing, even files that have nothing to do with the cloned directories, and even if I carefully re-sync each of the two clones to the exact same state. I don't know if the problem is files under .git/ or just something like race conditions between versions of the actual repo files.

I've tried to use Apple's various iCloud logging tools under brctl but that has generally not helped.

Has anyone else seen this or anything like it?

(This is somewhat different from this question which mostly seems to care about a single Mac with iCloud drive, and I don't think users in that situation would see the same issues that I am.)


回答1:


I have found the icloud and git do NOT play well together. icloud sticks dot files everywhere and if you're doing node with giant node_modules directories it makes for madness. It will restore old files and your repo is git functions are basically competing with whatever random backup and syncing icloud is doing.

My lesson is to NOT put any repos in any place that icloud is backing it up. Besides it's redundant if you have a git or bitbucket (or remote git) account elsewhere, since then by definition the repo is the restorable in a versioned way.




回答2:


to use iCloud (or Drive) for this task appears to be the whole wrong approach, because of several local working copies (which in case of git are repositories, too) and remote repositories might not be perfectly in-sync. better exclude these repositories from synchronization and setup a cron-job, which pulls them with git, as it is meant to be. alike this, the chances are small, that it might mess up the local .git directories (which aren't identical on each machine) - despite uncommitted files would not be instantly synchronized. this might at least explain, why synchronizing 1 single machine still works. I'd only synchronize the shell-script, which runs as a cron-job, which pulls these repositories - so that one conveniently can add/remove repositories from there.



来源:https://stackoverflow.com/questions/54992312/github-repo-cloned-to-synced-icloud-drive-on-multiple-computers

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