cloud-git 开发一个git server 试用

cloud-git 是基于nodejs 开发的一个express git 中间件,可以用来开发git server,以下是一个简单的使用

git server

  • package.json
{
  "name": "mygit",
  "version": "1.0.0",
  "main": "index.js",
  "license": "MIT",
  "dependencies": {
    "@fusebit/cloud-git": "^1.0.0",
    "express": "^4.17.1"
  },
  "scripts": {
    "start":"node app.js"
  }
}
  • app.js
const Express = require("express");
const { MemoryGitRepository } = require("@fusebit/cloud-git");
 
const app = Express();
app.use("/:repo", new MemoryGitRepository().createExpress(Express));
 
require("http").createServer(app).listen(3000);
  • 启动
yarn start

使用

  • 命令
mkdir test
cd test
git init
echo "Hello, world" > hello
git add .
git commit -am "init "
git remote add origin http://localhost:3000/dalong
git push origin master
  • 效果

 

 

说明

cloud-git 为我们提供了一个框架,对于存储部分以及认证部分提供了扩展点,实际需要使用的话,需要我们自己解决,默认提供了基于内存的实现

参考资料

https://github.com/fusebit/cloud-git

posted on   荣锋亮  阅读(68)  评论(0编辑  收藏  举报

编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
历史上的今天:
2020-10-06 drill http 存储插件试用
2020-10-06 apache drill 1.18.0 新特性
2020-10-06 drill 学习 十 drill rest api
2020-10-06 drill 学习 九 drill性能优化-整体介绍
2019-10-06 AsyncAPI 试用
2019-10-06 AsyncAPI and CloudEvents
2019-10-06 asyncapi 指南

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
点击右上角即可分享
微信分享提示