> ## Content Index
> Fetch the complete content index at: https://yinguobing.com/blog/llms.txt
> Use this file to discover other available public pages before exploring further.

# 创建Github仓库的本地镜像
- URL: https://yinguobing.com/blog/create-mirrored-repo-in-local-network/
- Published: 2017-04-25T09:00:00.000Z
- Updated: 2024-04-02T08:32:44.000Z
- Description: 在一家制造业公司从事软件开发的工作存在一个痛点就是Github的访问总是慢的让人抓狂。这种情况下针对一些常用的在Github上的开源项目，有必要在本地保存一份仓库的镜像，方便内网的用户抓取。
- Author: 尹国冰
- Tags: 新手入门

在一家制造业公司从事软件开发的工作存在一个痛点就是Github的访问总是慢的让人抓狂。这种情况下针对一些常用的在Github上的开源项目，有必要在本地保存一份仓库的镜像，方便内网的用户抓取。幸运的是，Github官方提供了这样的一份教程教你如何制作仓库镜像，地址如下：

[https://help.github.com/articles/duplicating-a-repository/](https://help.github.com/articles/duplicating-a-repository/?ref=yinguobing.com)

针对上述的情况，应当选择方案为 [Mirroring a repository in another location](https://help.github.com/articles/duplicating-a-repository/?ref=yinguobing.com#mirroring-a-repository-in-another-location)。

以OpenCV为例，首先创建一个本地的clone

```
git clone --mirror https://github.com/opencv/opencv.git

```

然后设定镜像仓库的地址

```
cd opencv.git
git remote set-url --push origin <your-mirror-location>

```

这样今后更新镜像只需要执行

```
git fetch -p origin
git push --mirror

```