用 Dropbox 做私有 Git 服务器

1. 安装GitHubSetup.exe for windows

2. 安装Dropbox 1.6.17.exe for windows


3.  D:\ 根目录下有自己的source目录

-D:\MySourceCode

 -README.txt

 -stdafx.cpp

 -include

  -stdafx.h



3. 打开GitShell, 安装完GitHub windows客户端会生成该快捷方式



4. gitshell 命令行界面

命令行默认路径为GitHub GUI客户端中设置的默认"default storage directory", 如下图



5. 

cd ..

cd .\MySourceCode



命令行结果,多出.git文件夹



6. 提交原有的code等文件到git 本地Repo

git add .
git commit -m "commit orignal source code."



7. 生成一个不带source code的Git仓库

cd ..
git clone --bare MySourceCode MySourceCodet.git


7. 生成一个不带source code的Git仓库

 

cd .. 
git clone --bare MySourceCode MySourceCodet.git
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器

用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器


8. 把MySourceCodet.git移动到Dropbox同步目录D:\Dropbox(一开始直接把MySourceCodet.git创建在同步目录也可以)

用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器


至此,dropbox的作为私有的git服务器功能已经完成

下面做实验
1. E盘下创建test1目录
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器


2. gitshell 
cd E:\test1
git clone file:///D:\Dropbox\MySourceCodet.git
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器

E:\test1目录下clone了MySourceCode的代码
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器

3. 通过notepad编辑E:\test1\MysourceCodet下的代码

4. GitShell
cd .\MySourceCodet
git pull //把远端Repo上的文件拉下来
git status //查看mofify状态
git add . //把所有文件添加进需要commit的列表
git commit -m "msg: commit updated files"
此时已经把user的修改提交到本地的Repo
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器


5. 把本地repo的改动push到远端Repo
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器

6. 在E:盘下创建E:\test2

7. gitshell
cd ..
cd ..
cd test2
git clone file:///D:\Dropbox\MySourceCodet.git
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器

8. 进入test2查看,是test1最新commit到远端服务器的代码
cd MySourceCode
git log
用 <wbr>Dropbox <wbr>做私有 <wbr>Git <wbr>服务器

遗留问题:
git remote add origin  file://xxxx/MySourcecode .git这个命令用来做什么,添加远程仓库?具体什么含义

参考文献



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值