Git + Google Drive = Simple Git Host
Github, Bitbucket, GitLab, Google Cloud Source Repositories (along with many others) are fantastic Git hosting services. But for personal projects and small team collaboration Google Drive can also provide a simple solution.
Let’s see how easy this is to setup.
Configure Google Drive for Personal Git Hosting
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.
git clone --bare . PATH_TO_GOOGLE_DRIVE_SYNC_FOLDER/ANY_SUBFOLDER_PATH/PROJECT_NAME.git
Example: git clone --bare . ~/GoogleDrive/Git/addon.git
STEP 4: Configure a Git remote.
git remote add REMOTE_NAME PATH_TO_GOOGLE_DRIVE_SYNC_FOLDER/ANY_SUBFOLDER_PATH/PROJECT_NAME.git
Example: git remote add gdrive ~/GoogleDrive/Git/addon.git
STEP 5: Push/Pull project changes to/from the remote … changes will sync with Google Drive.
Example: git push gdrive master
OR
Example: git pull gdrive master
Share a Google Drive Hosted Git Project
STEP 1: Share the Git repository folder with project collaborators from Google Drive.
Each collaborator should then:
STEP 2: Download and install Google Drive for desktop and ensure that Git is installed on their system.
STEP 3: Sync the shared Git project folder to their local Google Drive.
STEP 4: Open a command-line interface in a new folder and execute the Git clone command to clone the shared project.
git clone PATH_TO_GOOGLE_DRIVE_SYNC_FOLDER/ANY_SUBFOLDER_PATH/PROJECT_NAME.git
Example: git clone ~/GoogleDrive/Git/addon.git
STEP 5: Configure a Git remote for the shared project.
git remote add REMOTE_NAME PATH_TO_GOOGLE_DRIVE_SYNC_FOLDER/ANY_SUBFOLDER_PATH/PROJECT_NAME.git
Example: git remote add gdrive ~/GoogleDrive/Git/addon.git
STEP 6: Push/Pull project changes to/from the remote … changes will sync with Google Drive.
Example: git push gdrive master
OR
Example: git pull gdrive master
BEST PRACTICE — When sharing the Git repository, collaborators should coordinate ‘push’ and ‘pull’ operations to avoid sync conflicts which could leave the Git repository in an unstable state.
Dropbox is another alternative for simple Git hosting.
Need help automating processes inside your G Suite organization? Get in touch
Follow me on Twitter, Medium & Github.