简体   繁体   中英

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). I would like to set up a 'central' git repo on the intranet, from/to which all developers can pull/push commits.

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. That is, I don't want to give ssh keys or username/passwords of our github account to our developers or their computers.

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
  • upon watchdog debounced trigger, use GitPython to do a git push to github

One possibility is to setup a server which will listen to push/pull and update your intranet repo.

Typically, I use a GitHub-like server: Gitea , because it is one executable (no dependencies) + 1 PostreSQL database.

From there, you can setup a mirroring between your GItea and GitHub .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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