1

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.

dahuiwong
  • 45
  • 4
  • What happens when you type `git ststus`? Does `git checkout master` work? – dan1st Sep 06 '20 at 14:24
  • Do you see the expected download/upload log in both your Google drive clients ? Are you the only one to use this shared folder ? – LeGEC Sep 06 '20 at 20:56

1 Answers1

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.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks for the tip. After a lot of frustration I found out that it indeed had to do with the fact that it's a "sync-drive", I switched to a network NAS which is less comfortable to use, but at least not failing me every day. – dahuiwong Sep 15 '20 at 17:55