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

后端 未结 7 2173
滥情空心
滥情空心 2020-12-03 06:27

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 alto

7条回答
  •  死守一世寂寞
    2020-12-03 07:08

    Here is a very good article on the subject (archived version here, with the relevant parts reproduced here):

    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."
    

    Change the directory to where your Google Drive is located and initialize a bare repository:

    $ cd /Users/myusername/Google\ Drive/
    $ mkdir johndoe
    $ cd johndoe
    $ git init --bare
    

    Go back to your working directory:

    $ cd /var/www/html/johndoe
    $ git remote add origin file:///Users/myusername/Google\ Drive/johndoe
    $ git push origin master
    

    To clone your Git repository from Google Drive:

    $ cd /var/www/html/johndoe2
    $ git clone file:///Users/myusername/Google\ Drive/johndoe
    

提交回复
热议问题