Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1260832
  • 博文数量: 254
  • 博客积分: 1586
  • 博客等级: 上尉
  • 技术积分: 2295
  • 用 户 组: 普通用户
  • 注册时间: 2009-01-15 16:38
个人简介

linux学习中

文章分类

全部博文(254)

文章存档

2016年(6)

2015年(2)

2014年(74)

2013年(93)

2012年(12)

2011年(2)

2010年(51)

2009年(14)

分类: LINUX

2014-11-27 10:16:31

How to create a repo mirror



Introduction

Creating a repo mirror is useful in many cases, especially when you want to save time and bandwidth to synchronize a remote repo on multiple local stations.

As you can guess, it requires two major steps to create a repo mirror which can be accessed remotely:

  • Set up a remotely accessible git server, which provides git services via ssh/git, or furthermore http;
  • Create a repo mirror from upstream, and change the manifest file accordingly;

These two steps will be discussed in following sections.

Publish git service via git-daemon

The first thing is to set up a server hosting git repositories. The following two articles can be referenced for more details:

  1. Hosting git repositories
  1. Step 1, add a linux user named “git” in the system and do some preparation work:

    You may need to set a password for “git” user:

    Switch to git user and create a folder to hold all repositories:

    Now /home/git/repositories should have been created.
  2. Step 2, configure git-daemon to run as a system service. Of course, to do this you need to have git-core package installed already.

    Create a init.d script for git-daemon:

    Copy the following into git-daemon script:

    Start git-daemon service:

    Check git-daemon is running correctly:

Now git-daemon is running and monitoring /home/git/repositories folder, any git repositories created in this folder or its sub-folder can be accessed via git://yourhost/path/to/your/gitrepo.

Create repo mirror and update manifest file

Once git-daemon is running, we can start to create a repo mirror.

  1. Step 1, create a mirror repo use the following command:
  2. Step 2, update the foo repo manifest on a client macine, this is important:

    Edit the manifest xml file as you needed, add your repo mirror server as the default remote target.
    For example, in the modification showed below, 10.21.0.101 is added as the default remote target.

    Commit this change and push it back to repo mirror server:

Now a READ-ONLY repo mirror is configured. You can init and sync it from it:


This entry was posted in linuxTechnical on June 27, 2013.
阅读(1689) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~