原帖地址:点我
How to use Google Drive or Dropbox to host your private Git repositories
This was something that I needed to do (for my own personal and private projects). While there are many ways out there to host your private repositories such as the awesome Bitbucket, Github, etc, I was looking at much simpler solution just for myself. All I needed is a versioning system to keep my source codes.
In this tutorial I'm going to demonstrate how easy it is to host your own Git repositories in any of your preferred cloud providers. I chose Google Drivepersonally.
Lets say you have a project named "johndoe" with a file "README" like below:
/var/www/html/johndoe/
/var/www/html/johndoe/README
Initialise an empty Git repository here.
$ cd /var/www/html/johndoe
$ git init
$ git add README
$ git commit README -m "Initial commit."
Now for the fun part. Change directory to where your Google Drive is located and initialise a bare repository.
$ cd /Users/myusername/Google\ Drive/
$ mkdir johndoe
$ cd johndoe
$ git init --bare
Getting back to your working directory..
$ cd /var/www/html/johndoe
$ git remote add origin file:///Users/myusername/Google\ Drive/johndoe
$ git push origin master
Walla :)
Edit: How to clone your Git repository from Google Drive
I missed this part earlier, adding to this article..
$ cd /var/www/html/johndoe2
$ git clone file:///Users/myusername/Google\ Drive/johndoe