Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

There are methods to sync my local git repository over to my google drive via google drive sync windows application, but I was wondering whether I could bypass its need altogether.

Fro eg.

$ git remote add origin https://drive.google.com/<my_folder>/<my_repository>.git $ git push github master 
like image 255
laggingreflex Avatar asked Apr 11 '13 11:04

laggingreflex


People also ask

Can I use Google Drive as git repository?

STEP 1: Download and install Google Drive for desktop and ensure Git is installed on your system. STEP 2: Open a command-line interface and create a Git repository for your project. STEP 3: From inside the project folder, create a 'bare' Git clone of the repository on Google Drive. STEP 4: Configure a Git remote.

How do I push to Google Drive?

On your computer, go to drive.google.com. Open or create a folder. To upload files and folders, drag them into the Google Drive folder.

What is git clone bare?

git clone --bare origin-url : You will get all of the tags copied, local branches master (HEAD) , next , pu , and maint , no remote tracking branches. That is, all branches are copied as is, and it's set up completely independent, with no expectation of fetching again.


1 Answers

No, you can't. There's no git running on Google drive.

I would also suggest against Google drive/Dropbox based solutions, and go for a git hosting solution instead. For example Bitbucket which offers some free private repositories. You can find some comparison information about different git hosting sites here.

As people have pointed out (and as OP already knows), you can put the bare repository inside your local Google Drive/Dropbox folder and work with that, however, there are caveats. The cloud services have their own systems for merging conflicts, and that doesn't really work with git. Consider the scenario:

  • You work with device A offline, push some commits to the bare repository in Google Drive folder, but because you are offline, those changes do not sync to the cloud.

  • You then forget about it, work with device B online, push commits to Google Drive folder, and those changes do get synced.

  • Device A becomes online - you now have a conflict in Google Drive.

This is, of course, recoverable, but inconvenient. I therefore recommend to use a solution that is designed precisely for git hosting.

like image 145
1615903 Avatar answered Oct 11 '22 22:10

1615903