Google云端硬盘上的远程存储库一天可以正常运行,而第二天无需我干预即可进行分解 [英] Remote repo on Google Drive working fine one day, breaks down the next without me touching it
问题描述
所以我想为自己创建一个远程git存储库,我可以用它在不同的机器上工作.听起来很简单,Google驱动器为PC和Mac(我同时使用)提供了其同步实用程序.我几乎按照此指南创建了一个远程存储库: https://medium.com/@techstreams/git-google-drive-simple-git-host-3a84db4fc1fd
第一天工作正常-我可以在Macbook上进行提交和推送,在PC上查看更改,在PC上进行提交等等.
需要提及的是,我主要使用Android Studio,并且内置了VCS,因此我使用了它.一切正常.
第二天,我只在Mac上工作,当我想在PC上进行更改时,出现错误提示
"无法更新:没有为之配置跟踪分支分支主管."
请注意,它之前运行得非常好,而我在Mac上所做的唯一一件事就是Commit& push-同样,就像之前一样.我没有以任何方式触摸Google云端硬盘文件夹.
无论如何,在尝试了不同的方法之后,我终于解决了该错误,并且一切都重新开始了.一天后,情况重演.同样,我在Mac上工作,做了几次Commit& push,昨天PC进行了更改,今天却显示了相同的错误.并且 git fetch
命令显示:
错误:refs/heads/master没有指向有效的对象!
很显然,现在远程回购本身中的'git log'也告诉HEAD对象是坏的.
此设置我缺少什么?我的意思是,它有效,除了重复前一天有效的操作-BAM,我什么都没改变.错误.
我一直主张不要使用同步驱动器"(Dropbox,Google驱动器,One Drive等),用于 all Git存储库(工作树以及 .git
目录).
如果可以的话,您应该推送到 git bundle
,即一个文件.
您可以放心地将该文件保存在驱动器中:与许多 .git/
文件相比,该文件将被同步而不会出现问题.
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.
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.
这篇关于Google云端硬盘上的远程存储库一天可以正常运行,而第二天无需我干预即可进行分解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!