github存储库的本地缓存? [英] local cache for a github repository?

查看:234
本文介绍了github存储库的本地缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用github来管理大量的软件环境,我敢打赌,像许多其他组织一样,往返于该回购源的绝大多数流量都来自我们的办公室。考虑到这一点,是否有一种方法可以为给定的github存储库构建本地缓存,但是仍然可以保护云版本?我在缓存代理服务器模型中考虑了这一点,其中本地服务器(大概是在我们大楼中,在本地网络上)将处理绝大多数克隆/拉操作。

We use github to manage a great deal of our software environment, and I would wager that like many other orgs the overwhelming majority of traffic to/from that repo comes from our office. With that in mind, is there a way to build a local cache of a given github repository, but still have the protection of the cloud version? I'm thinking of this in the model of a caching proxy server, where the local server (presumably in our building, on our local network) would handle the vast majority of cloning/pull operations.

这似乎应该可行,但是搜索起来却非常困难,我认为这在很大程度上是因为本地和缓存一词已超载尤其对于git(hub)问题的含义。

This seems like it should be doable, but searching for this has been very difficult, I think in no small part because the words "local" and "cache" have overloaded meanings especially for git(hub) questions.

推荐答案

您最近的评论清楚地表明您正在寻找性能优化的目标。

Your latest comment makes it clear you're looking for a performance optimization. That helps.

您可以首先在这些说明。您可以定期更新它,也可以安排从github接收网络挂钩进行更新本地镜像按需。为此,您需要设置一个小型Web服务,该服务将响应github上的钩子。您可以通过转到 https://github.com/someuser/someproject添加网络挂钩/ settings / hooks / new 。您可能需要选择让我选择单个事件单选按钮,然后选择:

You can start by creating a local mirror of the github repository following these instructions. You can either periodically update it, or arrange to receive web hooks from github to update the local mirror "on demand". To do this you would need to set up a small web service that would respond to the hooks from github. You can add a web hook by going to https://github.com/someuser/someproject/settings/hooks/new. You will probably want to select the "Let me select individual events" radio button, and then select:


  • 删除

  • push

  • 创建

这将使您的缓存保持最新状态,

This would keep your cache up-to-date with respect to changes in available tags and branches.

设置一个git服务器,使该存储库在本地可用。就像运行 git daemon 一样简单,或者通过ssh访问本地帐户,或者根据您的本地要求提供更全面的功能。

Set up a git server that makes that repository available locally. This can be as simple as running git daemon, or a local account accessible via ssh, or something more full featured, depending on your local requirements.

然后,您将像这样设置本地工作副本:

Then you would set up your local working copies like this:

$ git clone http://localrepository/someproject.git
$ cd someproject
$ git remote set-url --push http://github.com/someuser/someproject.git

这会将每个存储库设置为从本地缓存中 pull ,但将更改推送到github。

This would set up each repository to pull from your local cache, but push changes upstream to github.

这篇关于github存储库的本地缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆