How to use Repo and how to set up Windows Subsystem for Linux (Ubuntu 20.04).

公開日: 2020年06月04日最終更新日: 2022年01月28日

The usage of Repo is organized. I'm going to try it out on Windows Subsystem for Linux (WSL).

I tried to run it on Linux on VirtualBox for the first time in a long time, but AMD-V and Hyper-V seemed to conflict with each other, and I couldn't boot the VM. So I decided to use Windows Subsystem for Linux (WSL) rather than disabling Hyper-V.
So I'll explain how to use Repo on WSL here.


Repo is a tool for managing multiple Git repositories and is used in Android OS development.


First, set up WSL.

Enable Windows Subsystem for Linux under "Enable or Disable Windows Features."
Then search for and install Ubuntu in the Microsoft Store. I installed Ubuntu 20.04.

When Ubuntu is ready to be installed, the terminal will open and you can update it.

sudo apt-get update
sudo apt-get updgrade

Git is pre-installed, so you can just set it up.

git config --global ""
git config --global "username"

I'll also install a python and create a symbolic link for the repo.

sudo apt install python3 python3-pip -y
sudo pip3 install pip -U
sudo ln -s /usr/bin/python3 python

Installing Repo

Install Repo. Google to get it.

curl > ~/bin/repo
chmod a+x ~/bin/repo

How to use Repo

The following repository is used to illustrate this. It contains only the manifest xml file and the markdown file needed for the repo.


Let's assume that the directory structure is as follows Assume that dir_a, dir_b, and dir_c are maintained in separate git repositories.

├── dir_a/
│   └── dir_c/
└── dir_b/

The above directories and their corresponding git repositories are as follows

You can use Repo to perform operations on these git repositories/directories across the board.


Repo uses manifest to manage your git repository and directories, and this manifest is also managed by your Git repository. And the manifest is also managed by a Git repository. The name of this repository is as follows

manifest is an xml file, which in this case is described as follows

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

  <remote  name="origin"

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

  <project path="dir_a"
  <project path="dir_b"
  <project path="dir_b/dir_c"
  • The name of the remote is the name of the remote repository and the fetch is the information of the target server.
  • The default revision is the master branch and the remote is the origin (you should set the git remote set origin in advance). (You can use git remote set origin beforehand)
  • The path of the project is the directory where the repository is located, and the name is the repository. If you don't specify remote etc. here, default is used.

See repo's web page for details of the format.

Check the operation

You will actually get the source code from multiple repositories with Repo and extract it to a local directory.

First of all, you need to run repo init with your manifest. This command gets the manifest of Repo from Git repository and initializes the directory for repo.

mkdir ~/repo-test
cd ~/repo-test
repo init -u

If you want to check your own repository, make sure you have configured the ~/.ssh directory in advance to allow git commands to run in your environment.

Next, retrieve the source code from the repository based on the manifest you got.

repo sync

If the repo sync stops asking for your private key password in the middle of a repo sync, you can ssh-add it.

ssh-add ~/.ssh/id_rsa

If the repo sync succeeds, the repository contents will be extracted to the specified directory, as described in the manifest. If you check it, it should look like this

├── dir_a
│   ├── [files]
│   └── dir_c
│       └── [files]
└── dir_b
    └── [files]

Each directory is just a git clone, so you can do things like git commit, git push, etc. in each directory as usual.

There are many more commands in repo than just a sync. You can diff multiple repositories, and you can run shell commands on multiple repositories. Check out the [Repo command reference] ( for a brief description. seems to work on Windows as well.