4

Some people in my company use Repo to manage multiple repositories. I need to read (not alter/commit) some of this content.

I'm hoping to avoid installing Repo, and just use Git. Here are the instructions provided for getting the repository I care about:

repo init -u git://git-master/x/manifest.git -b dev/foo-bar -m bar.xml
repo sync

How can I use vanilla Git to synchronize this same information?

Phrogz
  • 271,922
  • 98
  • 616
  • 693

1 Answers1

3

git-repo use a file called manifest.xml to list all the git repositories of your project.

To get access to the repository using git only, you just have to get the manifest.xml, read the repository URL, and clone it.


First: Get the manifest

$ git clone -b dev/foo-bar git://git-master/x/manifest.git
$ vi manifest/bar.xml

Second: Read the repository URL

You should have something like this (check the manifest format):

<?xml version="1.0" encoding="UTF-8"?>
<manifest>

  <remote  name="origin" fetch="git://git-master/x" />

  <default revision="master" remote="origin" />

  <project name="my/first/project" />
  <project name="my/second/project" />

</manifest>

Search the repository you want to clone (e.g my/second/project), build the clone URL from the manifest.remote.fetch property. Here we have:

clone URL = git://git-master/x/my/second/project

NOTE: The manifest.remote.fetch can be an absolute or a relative URL. If it is a relative, you have to add the manifest URL before.


Third: Clone the repository

git clone git://git-master/x/my/second/project

NOTE: You can check the manifest.default.revision and the manifest.project.revision to be sure that you have fetch the good branch.


Nevertheless, as repo is just a script you can easily install it in your home directory, like this:

$ mkdir ~/bin
$ PATH=~/bin:$PATH
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
jmlemetayer
  • 4,334
  • 1
  • 28
  • 42