`
wbj0110
  • 浏览: 1587682 次
  • 性别: Icon_minigender_1
  • 来自: 上海
文章分类
社区版块
存档分类
最新评论

Using Dropbox as a Git repository

阅读更多

Someone in the CocoaHeads mailing list mentioned that it is possible to use Dropbox as a remote repository for Git and I thought I’d give it a try. It turns out it is actually pretty easy to set it all up so here are the quick steps for anyone who is interested (these are only applicable to Macs).

This is actually a great way to work collaboratively and remotely with other developers, or simply keep project files in sync between two different computers. In my case when working from home I’m usually on the iMac and on the road with the Macbook Pro so this works really well and allows me to work on the same project from different computers without the hassle of remembering to copy files across etc.

1) Firstly make sure you have the Dropbox app and Git installed on your Mac. If not, you can get Dropbox from here (direct download link) and the latest version of Git from here

2) With Dropbox and Git installed, you need to create a bare repository which will be shared with your Dropbox account. Open a Terminal window in your Mac and do the following:

[bash]
$ cd ~/Dropbox
$ mkdir -p repos/your-repo-name
$ git init –bare repos/your-repo-name
Initialized empty Git repository in /Users/xxxxxx/Dropbox/repos/your-repo-name/
[/bash]

3) Now with our bare repository created, head to your project folder and let’s start a local git repo and link it with the Dropbox one. If you already have a local repo, skip to step 4:

[bash]
$ cd ~/ProjectFolder
$ git init .
Initialized empty Git repository in /Users/xxxxx/ProjectFolder/
$ git add .
$ git commit –all -m "Initial commit"
$ git remote add dropbox /Users/xxxxx/Dropbox/repos/your-repo-name/
$ git push dropbox master
[/bash]

Essentially what we’ve done here was initialise a local repo, add and commit all files within that folder to the local repo. We then add a new remote location using the handle “dropbox” to this repo and finally push all the local changes to the “remote” repo (i.e. your Dropbox repo folder).

The rest is done automatically by Dropbox – your folder will be synced with your account and accessible from anywhere. For instance, if you wanted to clone the repo to a different machine, all you need to do is make sure Dropbox is installed and the folders are synced – and then issue the following command:

[bash]
$ cd ~/Projects
$ git clone -o dropbox /Users/xxxxx/Dropbox/repos/your-repo-name/
[/bash]

If everything goes right, you should have a local copy of your remote repo already configured with your dropbox remote. You can start making changes to your project and when ready, push them back to the remote:

[bash]
$ git commit –all -m "Changes made!"
$ git push dropbox master
[/bash]

And finally, when you want to sync the remote repository with your local copy, you can:

[bash]
$ git pull dropbox master
[/bash]

I hope it helps.

分享到:
评论

相关推荐

    Python_Git和Dropbox之间的透明桥梁使用Dropbox共享文件夹作为Git远程.zip

    本资料"Python_Git和Dropbox之间的透明桥梁使用Dropbox共享文件夹作为Git远程.zip"探讨了一个创新的方法,即如何将Dropbox作为Git的远程仓库,实现两者之间的无缝协作。 首先,我们需要理解Git的基本概念。Git是一...

    git-dropbox:将 Dropbox 用于 git 存储库的最简单方法

    git-dropbox 状态:稳定(截至 2012 年 8 月 3 日)——这不是一个非常复杂的项目,而且似乎相对没有错误。 目前没有进一步的改进计划,但提交的问题将得到回应。 最近的让我思考:将 Dropbox 用于您的 git 存储库...

    git-remote-dropbox:Git和Dropbox之间的透明桥梁-将Dropbox(共享)文件夹用作Git远程! :wrapped_gift:

    git-remote-dropbox git-remote-dropbox是Git和Dropbox之间的透明双向桥梁。 它使您可以使用Dropbox文件夹或共享文件夹作为Git远程! 这个Git远程帮助程序使Dropbox像一个真正的Git遥控器一样工作。 在使用Dropbox...

    Android代码-dropbox-sdk-java

    A Java library to access Dropbox's HTTP-based Core API v2. This SDK also supports the older Core API v1, but that support will be removed at some point. License: MIT Documentation: Javadocs Setup If ...

    Visual Studio中的.git和Dropbox集成

    本文将深入探讨如何在Visual Studio中集成.git和Dropbox,以便实现高效且安全的代码管理。这两大工具的结合,为C#、.NET开发者提供了强大的协作与备份解决方案。 首先,让我们了解一下.git。Git是一种分布式版本...

    Dropbox 1.3.13.exe Dropbox测试版

    Dropbox 1.3.13.exe Dropbox测试

    Laravel开发-dropbox

    在本文中,我们将深入探讨如何在Laravel框架中集成Dropbox服务,以便在你的Web应用程序中实现文件存储和同步功能。Laravel是一个流行的PHP框架,以其优雅的语法和丰富的生态系统而受到开发者的喜爱。Dropbox则是一个...

    Dropbox(多宝箱)在线+离线安装包

    Dropbox(多宝箱) 成立于2007年,提供免费和收费服务,在不同操作系统下有客户端软件,并且有网页客户端,能够将存储在本地的文件自动同步到云端服务器保存。因为云端服务的特性,Dropbox的存储成本将被无限摊薄。 ...

    Dropbox PDF

    ### Dropbox PDF:全面解析Dropbox的核心功能与使用技巧 #### 一、Dropbox简介 **Dropbox**是一款免费的云存储服务,它可以帮助用户轻松地将所有照片、文档和视频等文件随身携带。无论您是在学校、办公室还是家中...

    swift-GitMan基于Git的网盘式文件同步工具

    **Swift-GitMan:基于Git的网盘式文件同步工具** GitMan是一个创新的文件同步解决方案,它利用了Git的强大版本控制能力,将其应用于网盘式文件管理中。Git作为一个分布式版本控制系统,广泛用于软件开发,它允许...

    Laravel开发-laravel-dropbox

    在本文中,我们将深入探讨如何在Laravel框架中集成Dropbox服务,以便在Web应用程序中实现文件存储和同步。Laravel-Dropbox是为Laravel 5设计的一个Dropbox API桥接器,它使得开发者可以方便地利用Dropbox的云存储...

    dropbox0.7.1源码 dropbox source

    dropbox官方源码 2012-03-08 verison:0.7.1

    dropbox-sdk-java,一个用于Dropbox核心API的Java库。.zip

    **dropbox-sdk-java** 是一个专门为Java开发者设计的开源库,它使得与Dropbox的核心API进行交互变得简单而直观。这个库提供了全面的功能,包括文件上传、下载、管理,以及目录操作,同步,权限控制等,使开发人员...

    64位Ubuntu安装DropBox所需文件

    echo "/usr/bin/dropbox start -i" | sudo tee -a /etc/rc.local ``` 这样设置后,Dropbox将在系统启动时自动运行。 5. 最后,首次运行Dropbox,用户需要登录自己的Dropbox账户,这可以通过运行`dropbox start`...

    dropbox for linux 核心文件

    Dropbox是一款广受欢迎的云存储服务,它允许用户在多台设备之间同步文件和数据。在Linux系统中,虽然没有官方的图形化安装程序,但可以通过手动方式安装Dropbox的核心文件来实现服务。本篇文章将详细讲解如何在Linux...

    Dropbox 3.14.7 Offline Installer / DROPBOX 离线安装文件

    It’s easy to share large files with anyone — even if they don’t have a Dropbox account. Keep your photos safeBack up vacation photos automatically from your phone or computer. That way, memories ...

    dropbox网络硬盘客户端

    Dropbox是一款著名的云存储服务,它为用户提供了一个便捷的方式来存储、同步和分享文件。自推出以来,Dropbox凭借其简洁的界面和强大的功能赢得了全球用户的喜爱。标题中的“网络硬盘客户端”指的是Dropbox提供的一...

    Dropbox 1.0.20

    Dropbox 1.0.20 是一个历史悠久的版本,这款云存储服务的早期迭代为用户提供了方便的数据同步、备份和共享功能。Dropbox的主要目标是让用户能够在任何设备上访问和管理他们的文件,无论是在台式机、笔记本电脑还是...

    Dropbox云存储 2.3.12.10

    当你在电脑A使用 Dropbox时,指定文件夹里所有文件的改动均会自动地“同步”到 Dropbox的服务器,当下次你在电脑B需要使用这些文件时,你只需登录你的账户,所有被同步的文件均会自动下载到B电脑中,同样,你在电脑B...

    DropBox 2.2.10简体中文安装版

    DropBox 2.2.10简体中文安装版是一款深受用户喜爱的云存储服务,专为方便用户在多设备间同步和分享文件而设计。这个版本特别为中国用户提供了简体中文界面,使得操作更加直观易懂,尤其适合对英文界面不太熟悉的用户...

Global site tag (gtag.js) - Google Analytics