用本地裸仓建私有Git远程
推荐指数 54.0 NO. 018 · 2026.05.30
发布2026/05/29Score71Comments57
为什么值得看
通过git clone --bare将本地文件夹转为裸仓库,配合SSH实现零成本私有Git远程托管。适合不想用GitHub且已有NAS/服务器的开发者,省去自建Gitea的维护负担。
编辑判断
这个方案的真正价值不在技术本身,而在成本结构的重新计算。自建Gitea或GitLab需要持续维护、更新、备份,而裸仓库方案把Git的分布式特性用到了极致——任何有SSH访问的目录都能成为权威源。
但需要注意边界:没有Web界面意味着PR流程、CI触发、权限管理都要另想办法。适合个人项目或2-3人的极客团队,超过5人协作建议还是上Gitea或Codeberg。另外裸仓库直接暴露在文件系统,记得做定时rsync或restic备份,否则rm -rf就是灾难。
社区反馈
意见分歧 55 条评论
核心争论:裸仓本地远程是实用技巧还是多此一举,GitHub是否让开发者遗忘git分布式本质
GitHub has been such a staple of the modern dev that some are now (re)discovering git is distributed.
Everything old is new again. I wouldn't be surprised if there were people that thought GitHub invented git.
More precisely, a movement to leave GitHub mistakenly endeavors to leave git.