Remote repo on Google Drive working fine one day, breaks down the next without me touching it

吃可爱长大的小学妹 提交于 2021-02-08 07:05:46

问题


So I wanted to make a remote git repository for myself that I can use to work on different machines. Sounds simple, Google drive offers its sync utility for PC and Mac (I use both) so.. I created a remote repo, pretty much following this guide: https://medium.com/@techstreams/git-google-drive-simple-git-host-3a84db4fc1fd

It worked fine for the first day - I could commit&push on Macbook, see the changes on PC, commit&push on PC and so on.

Need to mention that I use Android Studio mostly and it has VCS built in, so I used that. Everything worked.

The next day I worked only on Mac, when I wanted to get the changes on PC, there was an error saying

"Can't update: no tracked branch No tracked branch configured for branch master."

Note that it worked perfectly well before and the only thing I did on Mac is Commit&push - again just like before when it worked. I didn't touch the Google drive folders in any way etc.

Anyway, after trying different methods I finally fixed this error and everything worked again. A day later the situation repeats itself. Again, I worked on Mac and did Commit&push few times, yesterday PC was getting the changes, today it shows that same error. And the git fetch command shows:

error: refs/heads/master does not point to a valid object!

Obviously, now the 'git log' inside the remote repo itself also tells that the HEAD object is bad.. duh.

What am I missing with this setup? I mean, it works, I change nothing except repeating actions that worked the previous day - bam! an error.


回答1:


I have always advocated against using a "sync drive" (dropbox, Google drive, One Drive, ...) for a all Git repository (working tree plus .git directory).

If you can, you should push to a git bundle, which is one file.
You can safely have that file in your drive: it will be synchronized without issue, as opposed to the many .git/ files.



来源:https://stackoverflow.com/questions/63761780/remote-repo-on-google-drive-working-fine-one-day-breaks-down-the-next-without-m

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