标签:
原理:在dropbox中建立git仓库,然后共享文件夹,从而实现多人协作。例如我们要在Dropbox/project/目录下建立demo.git项目:
首先,进入 DropBox
目录
Air:Dropbox admin$ pwd
/Users/admin/Dropbox
Air:Dropbox admin$ mkdir project
Air:Dropbox admin$ cd project/
Air:project admin$ mkdir demo.git
Air:project admin$ ls
demo.git
Air:project admin$ cd demo.git/
初始化
Air:demo.git admin$ git init --bare
Initialized empty Git repository in /Users/admin/Dropbox/project/demo.git/
Air:demo.git admin$ cd ~
Air:~ admin$ mkdir codea
Air:~ admin$ cd codea/
执行 clone
Air:codea admin$ git clone /Users/admin/Dropbox/project/demo.git/ demo
Cloning into ‘demo‘...
warning: You appear to have cloned an empty repository.
done.
查看执行结果:
Air:codea admin$ ls
demo
Air:codea admin$ cd demo
Air:demo admin$ touch README
Air:demo admin$ git add README
Air:demo admin$ git commit -m "first commit"
[master (root-commit) e80b34f] first commit
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 README
Air:demo admin$ git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 210 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To /Users/admin/Dropbox/project/demo.git/
* [new branch] master -> master
查看 DropBox 中的 repo 文件夹,发现已经更新
Air:demo admin$ cd /Users/admin/Dropbox/project/demo.git/
Air:demo.git admin$ ls
HEAD config hooks objects
branches description info refs
Air:demo.git admin$
以后所有的本地操作都在 ~/codea/
的 clone
文件夹中进行,执行完后合并入本地 DropBox
中,最后再把 DropBox
同步到网络端。
完毕。
全文深度参考《Dropbox 做私有 Git 服务器》
标签:
原文地址:http://my.oschina.net/freeblues/blog/412952