如何同时使用 Git 和 Dropbox? [英] How to use Git and Dropbox together?

查看:34
本文介绍了如何同时使用 Git 和 Dropbox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 GitDropbox 一起?

解决方案

我认为 Dropbox 上的 Git 很棒.我用它所有的时间.我有多台计算机(两台在家里,一台在工作),我将 Dropbox 用作中央裸存储库.由于我不想将它托管在公共服务上,而且我无法访问我可以始终通过 SSH 连接到的服务器,Dropbox 通过在后台同步来处理这个问题(非常快).

设置是这样的:

~/project $ git init~/project $ git add .~/project $ git commit -m 第一次提交"~/项目 $ cd ~/Dropbox/git~/Dropbox/git $ git init --bare project.git~/Dropbox/git $ cd ~/project~/project $ git remote add origin ~/Dropbox/git/project.git~/project $ git push -u origin master

从那里,您可以克隆该 ~/Dropbox/git/project.git 目录(无论它是属于您的 Dropbox 帐户还是在多个帐户之间共享)并执行所有正常操作Git 操作——它们会自动同步到你所有的其他机器上.

我写了一篇博文关于版本控制"我在其中介绍了我的环境设置背后的原因.它基于我的 Ruby on Rails 开发经验,但它可以应用于任何事情,真的.

Is it possible to use Git and Dropbox together?

解决方案

I think that Git on Dropbox is great. I use it all the time. I have multiple computers (two at home and one at work) on which I use Dropbox as a central bare repository. Since I don’t want to host it on a public service, and I don’t have access to a server that I can always SSH to, Dropbox takes care of this by syncing in the background (very doing so quickly).

Setup is something like this:

~/project $ git init
~/project $ git add .
~/project $ git commit -m "first commit"
~/project $ cd ~/Dropbox/git

~/Dropbox/git $ git init --bare project.git
~/Dropbox/git $ cd ~/project

~/project $ git remote add origin ~/Dropbox/git/project.git
~/project $ git push -u origin master

From there, you can just clone that ~/Dropbox/git/project.git directory (regardless of whether it belongs to your Dropbox account or is shared across multiple accounts) and do all the normal Git operations—they will be synchronized to all your other machines automatically.

I wrote a blog post "On Version Control" in which I cover the reasoning behind my environment setup. It’s based on my Ruby on Rails development experience, but it can be applied to anything, really.

这篇关于如何同时使用 Git 和 Dropbox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆