1

On Ubuntu 19.10. Where I have mounted my google drive in nautilus.

Out of curiosity I am trying to use google drive for a git remote (yes I know there are tons of free hosting options but I am curious to see if I can get this to work).

I found:

Can I push/pull directly from my google drive online?

But when I try to git init --bare sample.git in my mounted google drive I get

$ pwd
/run/user/1000/gvfs/google-drive:host=xxx.xx,user=xx/stuff
$ git init --bare sample.git
error: unable to write symref for HEAD: Input/output error

So I did the git init --bare sample.git outside my mounted google drive folder and copied it to my google drive sync folder which worked fine and gave me:

$ pwd
/run/user/1000/gvfs/google-drive:host=xxx.xx,user=xx/stuff/sample.git

Next up I configure the above "URL" as a remote for my existing local git repository and try and push to my google drive:

$ pwd
/home/user/stuff/sample
$ git log -1
commit 654c..3092 (HEAD -> master)
Author: ...
Date:   ...
$ git remote add origin /run/user/1000/gvfs/google-drive:host=xxx.xx,user=xx/stuff/sample.git
$ git push -u origin master
Enumerating objects: 516, done.
Counting objects: 100% (516/516), done.
Delta compression using up to 8 threads
Compressing objects: 100% (270/270), done.
Writing objects: 100% (516/516), 411.83 KiB | 57.00 KiB/s, done.
Total 516 (delta 296), reused 409 (delta 224)
remote: fatal: premature end of pack file, 36 bytes missing
remote: warning: die() called many times. Recursion error or racy threaded death!
error: remote unpack failed: index-pack abnormal exit
To /run/user/1000/gvfs/google-drive:host=xxx.xx,user=xx/stuff/sample.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '/run/user/1000/gvfs/google-drive:host=xxx.xx,user=xx/stuff/sample.git'

A second try gives:

$ git push -u origin master
Enumerating objects: 516, done.
Counting objects: 100% (516/516), done.
Delta compression using up to 8 threads
Compressing objects: 100% (270/270), done.
Writing objects: 100% (516/516), 411.83 KiB | 66.00 KiB/s, done.
Total 516 (delta 296), reused 409 (delta 224)
remote: Resolving deltas: 100% (296/296), done.
remote: fatal: write error: Operation not supported
error: remote unpack failed: index-pack abnormal exit
To /run/user/1000/gvfs/google-drive:host=xxx.xxk,user=xx/stuff/sample.git
 ! [remote rejected] master -> master (unpacker error)
error: failed to push some refs to '/run/user/1000/gvfs/google-drive:host=xxx.xx,user=xx/stuff/sample.git'

Any ideas?

u123
  • 15,603
  • 58
  • 186
  • 303
  • [This](https://stackoverflow.com/a/46348140/10155936) may be relevant here – Saurabh P Bhandari Apr 21 '20 at 09:49
  • Hm the specific details for doing that with a google drive mount and /etc/fstab are not described so that will require some trial and error it seems. Also I am not really up for an approach where I need to store my creds in a file on my local machine. – u123 Apr 21 '20 at 11:04
  • Network file systems / shared-drives in general *do not* provide the same kinds of behaviors as local ones. Promises about atomicity of operations, or ordering with calls to `fsync`, or the like get broken, for instance. Sometimes files disappear and then reappear. Some networked file systems are better than others but the "further away" the networked file system is, the worse things tend to get here. I would not use this with Git. – torek Apr 21 '20 at 17:31

1 Answers1

1

Got it to work with google-drive-ocamlfuse:

https://www.omgubuntu.co.uk/2017/04/mount-google-drive-ocamlfuse-linux

everything now works as expected.

u123
  • 15,603
  • 58
  • 186
  • 303