有一些方法可以通过google drive sync windows应用程序将我的本地git存储库同步到我的google drive上,但我想知道是否可以完全绕过它的需要。
例如。
$ git remote add origin https://drive.google.com/<my_folder>/<my_repository>.git
$ git push github master发布于 2013-04-11 19:36:13
不,你不能。谷歌硬盘上没有运行git。
我还建议不要使用基于Google drive/Dropbox的解决方案,而应该使用git托管解决方案。例如Bitbucket,它提供了一些免费的私有存储库。你可以找到一些关于不同git托管网站here的比较信息。
正如人们已经指出的(正如OP已经知道的),你可以将裸存储库放在你本地的Google Drive/Dropbox文件夹中并使用它,然而,有一些警告。云服务有自己的系统来合并冲突,这在git上是行不通的。请考虑以下场景:
当然,这是可以恢复的,但并不方便。因此,我建议使用专门为git托管设计的解决方案。
发布于 2014-01-20 18:46:48
关于这个主题的Here is a very good article (archived version here,相关部分在这里转载):
假设您有一个名为johndoe的项目,其文件README如下所示:
/var/www/html/johndoe/
/var/www/html/johndoe/README在此处初始化一个空的Git存储库:
$ cd /var/www/html/johndoe
$ git init
$ git add README
$ git commit README -m "Initial commit."将目录更改为Google Drive所在的位置,并初始化一个裸存储库:
$ cd /Users/myusername/Google\ Drive/
$ mkdir johndoe
$ cd johndoe
$ git init --bare返回到您的工作目录:
$ cd /var/www/html/johndoe
$ git remote add origin file:///Users/myusername/Google\ Drive/johndoe
$ git push origin master要从Google Drive克隆您的Git存储库:
$ cd /var/www/html/johndoe2
$ git clone file:///Users/myusername/Google\ Drive/johndoe发布于 2019-10-13 22:08:39
Eduardo Rosas有一个关于如何使用colab来做这件事的article (只需要一个浏览器)。基本上,您可以使用以下命令访问您的google驱动器:
from google.colab import drive
drive.mount('/content/gdrive')
#cd to the google drive you using the magic command
%cd /content/gdrive/'My Drive'/[your drive folder for repo]
#check your directory location with
!pwd
#clone your repo - Note this exposes your password so don't make the notebook public
!git clone https://LaloCo:password%23@github.com/LaloCo/handson-ml.git
#I find using a github personal access token easier
!git clone https://user:PAT@github.com/repohttps://stackoverflow.com/questions/15947502
复制相似问题