简体   繁体   English

链式 git 远程:dev repos -> 内网 repo -> github 上的 repo

[英]Chained git remotes: dev repos -> repo on intranet -> repo on github

Developers within the firm all has access to a git repo on our intranet (network drive).公司内的开发人员都可以访问我们内部网(网络驱动器)上的 git 存储库。 I would like to set up a 'central' git repo on the intranet, from/to which all developers can pull/push commits.我想在 Intranet 上设置一个“中央”git repo,所有开发人员都可以从中拉/推提交。

I would like this intranet repo to be synchronized with a remote repo on github, with only one admin account (myself) having any access to the github repo.我希望这个内网 repo 与 github 上的远程 repo 同步,只有一个管理员帐户(我自己)可以访问 github repo。 That is, I don't want to give ssh keys or username/passwords of our github account to our developers or their computers.也就是说,我不想将我们的 github 帐户的 ssh 密钥或用户名/密码提供给我们的开发人员或他们的计算机。

How can I achieve this given I have all the ultimate privileges within the firm?鉴于我在公司内拥有所有最终特权,我如何才能实现这一目标?

dev1 <-\
        --> intranet repo --> github repo
dev2 <-/

Edit:编辑:

The solution I decided on:我决定的解决方案:

  • Use python watchdog on my machine with access to my ssh keys and ssh-agent, to monitor for changes to intranet repo.git/refs/heads/ folder (which should be sufficient given it is a bare repo), debounce it在我的机器上使用 python 看门狗,可以访问我的 ssh 密钥和 ssh-agent,以监视对 Intranet repo.git/refs/heads/ 文件夹的更改(鉴于它是一个裸仓库,这应该足够了),对其进行去抖动
  • upon watchdog debounced trigger, use GitPython to do a git push to github在看门狗去抖动触发后,使用 GitPython 对 github 进行 git push

One possibility is to setup a server which will listen to push/pull and update your intranet repo.一种可能性是设置一个服务器,该服务器将侦听推/拉并更新您的 Intranet 存储库。

Typically, I use a GitHub-like server: Gitea , because it is one executable (no dependencies) + 1 PostreSQL database.通常,我使用类似 GitHub 的服务器: Gitea ,因为它是一个可执行文件(无依赖项)+ 1 个 PostreSQL 数据库。

From there, you can setup a mirroring between your GItea and GitHub .从那里,您可以在 GItea 和 GitHub 之间设置镜像

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM