Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Google Drive can corrupt repositories" in Github Desktop

I primarily work out of a Google Drive folder and it is mentioned in Github Desktop when creating a new repository that "Google Drive can corrupt repositories".

enter image description here

What are the issues specifically and what can be done to avoid repositories being corrupted?

like image 379
Marcel Avatar asked Aug 13 '15 09:08

Marcel


People also ask

Can I use GitHub with Google Drive?

GitHub + Google Drive IntegrationsZapier lets you send info between GitHub and Google Drive automatically—no code required. Triggered when a new branch is created. automatically do this! Adds a sharing scope to the sharing preference of a file.

What is the difference between GitHub and Google Drive?

GitHub is a place to share code with friends, co-workers, classmates, and complete strangers, helping individuals and teams... Google Drive is a cloud storage and backup platform to access files, docs, photos & more, store them in a safe place, and...

How do I create a Git repository in Google Drive?

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.

Can you put repositories in folders GitHub?

Original answer: On GitHub itself, you cannot group your repos by "folder", unless you create organizations.


2 Answers

We've put that warning in place because we've seen quite a few users get their repositories corrupted by various cloud-backed storage solutions such as Google Drive and Dropbox.

The problem boils down to a race condition where Git creates and modifies files rapidly and the storage solution trying to keep up. In some scenarios this can lead to file IO not behaving as Git expects. A storage solution might also erroneously restore a file that was meant to be removed. While these sort of issues are most likely to occur when you're sharing the repository with other people we've seen issues with people who only use the storage for backup purposes.

The best way to backup Git repositories is to commit early and often and push your changes to GitHub frequently, even if you push them to work-in-progress branches rather than master or other long-running branches.

If you're not using GitHub or any other remote and your repository is local I'd recommend creating a bare repository inside your Google Drive and then clone your repository to a location outside of Google Drive and work from there. Whenever you've made changes you can push those to the bare repository. That way you'll have two copies of all your data in case the Google Drive version gets corrupted.

like image 54
Markus Olsson Avatar answered Sep 17 '22 15:09

Markus Olsson


Google Drive already messed up my life two times (yes I needed to see the second to believe).

My solution to avoid forgetting push to a safe place I've created some automated tasks. You can create a scheduled task to commit and push your changes every each X hours/days...etc. to one work-in-progress branche for example. Using Unix based systems (Mac / Linux) you can use crontab.

First create one bash script, i.e: /home/myScripts/autoGit.sh

# add and commit changes
cd /home/myProject && /home/myGit commit -a -m "automated commit/push `date`"

# push git server
cd /home/myProject && /home/myGit push origin wip

Then you create your crontab job as needed:

crontab -e

then add the commands to the file

mailto: [email protected]
59 * * * 1,2,3,4,5 /home/myScripts/autoGit.sh

This will commit and push your repo every each 59 minutes on mon,tue,wed,thu,fri.

Hope it helps

like image 25
GIJOW Avatar answered Sep 17 '22 15:09

GIJOW