Closed swyxio closed 1 year ago
Oh wow! I also recently wrote about the same issue with Obsidian on iCloud: https://architchandra.com/articles/a-side-effect-of-storing-a-git-repository-in-icloud-drive. 🙌🏽
Really like how you've tackled everything through the command line. I hope it would be okay if I try some of your learnings and incorporate them into my article later. Thanks!
I love your content, btw. You're an inspiration. :)
you're welcome! thanks for the nice note!
Thanks for the tips.
The ultimate solution to your particular issue to not store .git repositories in iCloud. They are designed to pushed and pulled to external remotes and that's the way to back them up/sync them. You don't need iCloud in this case, and neither of these things were designed to be used the way you're trying to use them.
The reason iCloud messes with git repositories is because they are highly specialized and operate in a different way a human would interact with files. File sync services don't expect this.
There might be a way to hold the repo outside the folder, outside of iCloud's view, using a git worktree, but when checking out different repo states this could cause syncing slowdowns and unneccesary syncs.
Just don't do it :-) you are asking for trouble. It's not iCloud, it's the same with Dropbox for example.
@robrecord - You're absolutely right, but this is for when we still want to do it 😅. Storing Git repos in cloud-sync services should ideally be avoided, but it might still be the best bet for some people who don't want to pay extra for using Git features on mobile devices (eg. you need to install paid apps to do anything meaningful Git related stuff on iOS).
Just talking about Obsidian, I've been using iCloud Drive to keep notes in sync on my desktop and phone for quite a while now without much of a hassle, esp. since I removed the workspace.json
file from version control.
Can’t say fairer than that! :-)
If needed, I’m thinking you could, as mentioned, store the git repo outside the synced folders - happy to shed light if that’s of interest.
@robrecord I personally store my code on both Synology Drive and GitHub because I like having an extra backup outside of a Git system. It’s also convenient to automatically sync secrets between devices.
category: note slug: solve-git-bad-object-head
as a cheapo who uses Apple iCloud (the world's worst sync service) as a sync service for my Obsidian Second Brain, I have recently run into this issue a lot:
The top Stackoverflow answer is 10 yrs old and tells you to rm -rf .git, which ofc is not what you want to do it "right".
I've had to fix this a few times, and only recently worked it out with ChatGPT. Saving here for posterity:
when it is more fucked than normal
If you see a lot of "2"'s, thats icloud fucking you up. solve with
Then you can
git fetch origin
again.If you have
then run
misc notes
This may show you some bad objects:
So the fix is this:
(July 31 update) corrupt loose object
I also had this issue today:
i got a lot of recommendations with exotic options but ultimately the fix was this