天天看点

[Node.js] 2、利用node-git-server快速搭建git服务器

该包的使用需要机器上本来就安装git,且git的版本大于等于2.7:

<a></a>

有警告可以先忽略~

cd ./node_modules/node-git-server/example/

编辑index.js

由于我的git服务器是在aliyun上跑的,并且绑定了www.beautifulzzzz.com,所以我先在本地新建一个git仓库,并将其推送同步到云端,然后再clone下来来做测试:

[Node.js] 2、利用node-git-server快速搭建git服务器

可见将本地git仓库同步到云端和普通的git服务器没有区别,简直太简单方便了!!!

[Node.js] 2、利用node-git-server快速搭建git服务器

同样git clone也比较简单!

在index.js中我们指定git仓库存放在:const repos = new Server('/tmp/repos');目录下

登录远程服务器可以发现在/tmp/repos/目录下存在我们同步的git仓库:(其中beep.git是之前push的一个)

本文转自beautifulzzzz博客园博客,原文链接:http://www.cnblogs.com/zjutlitao/p/7599781.html,如需转载请自行联系原作者

继续阅读