The 2020-02-22 update! I noticed that In the last few days Google has released git-repo version 2.4 and updated the Microsoft Windows Details documentation to directly address this issue, which is much, much simpler than the previous three-way solution to this article.

Latest official solution

1. Infrastructure

  • Install the latest Version of Git for Windows (2.25.1)
  • Install Python 3, currently 3.8.1, do not install Python 2, this is the difference from the old method
  • Configure various environment variables (see the previous article), which will be automatically configured when Python 3 is installed by checking the Add Path option

Get up to speed with the latest REPO tools

The Repo installation steps are similar to those in the previous article, but all have been replaced with the official Google:

mkdir ~/bin
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+rx ~/bin/repo
Copy the code

Download the source code of the latest repo tool and init it:

Create a new source directory
mkdir -p ~/AOSP/.repo
cd ~/AOSP/.repo
# Clone toolset
git clone https://gerrit.googlesource.com/git-repo
Make sure you change the folder name
mv git-repo repo
Go back to the AOSP source directory
cd.# Guarantee your successRepo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest - b android - 10.0.0 _r25 - worktreeCopy the code

GitError: Cannot initialize worktree for MANIFESTS error GitError: Cannot initialize worktree for MANIFESTS Google only updated this feature later this month.


The following is an old post that strongly recommends the latest official solution above the dividing line.

background

2020 has been a magical year, with people telecommuting for a while due to the pandemic. However, many colleagues do not have a Linux development environment at home, and it is extremely difficult to download Android source code through the REPo tool on Windows.

Online search to suffer not a few speak thoroughly, today to everyone whole live. Follow these steps to make sure that OK, and we eventually aim for successful repo init execution.

start

Install Git for Windows

Go to the official website (git-scm.com/download/wi…) Download 64-bit Git for Windows Setup and install it.

  • The first step, the first one, has an Add ICONS or something, which is adding desktop ICONS, and by default it’s unmarked, so you’d better put it.
  • In the last step, there are three Enable XXX options. By default, the third option (associated with Symbollink) is not ticked. Please tick it.

Install Python 2.7

Go to the website (www.python.org/downloads/r)… Download Windows x86-64 MSI Installer, which seems to be the last version of Python 2. The installation is the next step.

3. Configure system environment variables

The above two basic components installed, check the environment variables, Path Path should be added to add, Windows how to view and add system environment variables please search by yourself. You need to add the following:

C:\Program Files\Git\cmd
C:\Program Files\Git\bin
C:\Program Files\Git\usr\bin
C:\Python27\
C:\Python27\Scripts\
Don't forget to pre-configure for the REPOC:\Users\ your username \binCopy the code

The path depends on what you choose to install, so do not just copy it. I’ll give you the whole picture.

Install the REPO

Repo was originally developed by Google as an easy to download AOSP tool, based on Git, but for a variety of reasons, cannot be used directly on Windows. But the kindly gay Hub user created a modified version of the repO for Windows that solves all sorts of Error problems.

The first step is to get the repo script done. Open Git Bash anywhere (or a desktop shortcut) and then:

mkdir ~/bin
curl https://raw.githubusercontent.com/esrlabs/git-repo/stable/repo > ~/bin/repo
curl https://raw.githubusercontent.com/esrlabs/git-repo/stable/repo.cmd > ~/bin/repo.cmd
chmod a+rx ~/bin/repo
Copy the code

From there, it’s pretty much the same as on Linux. In repo init, however, the repo-URL parameter needs to be added or modified as follows:

Create a new source directory
mkdir ~/AOSP
cd ~/AOSP
# initializationRepo init -u https://aosp.tuna.tsinghua.edu.cn/platform/manifest - b android - 10.0.0 _r25 --repo-url=https://github.com/esrlabs/git-repo.gitCopy the code

Note:

  • That’s the key to the command--repo-url=https://github.com/esrlabs/git-repo.git, replace the native REPO toolchain, and the initialization is successful.
  • Here is the tsinghua image source AOSP as an example, generally do ROM development companies will have their own warehouse address, please modify the init link.
  • Don’t forget to generate the public key for SSH, even on Windows: do it in Git Bashssh-keygenAnd then copy~/.ssh/id_rsa.pubAdd the contents of the file to a source platform such as Gerrit.
  • If you find that the download speed is too slow, you can putGithub.com/esrlabs/git…The project is directly downloaded and decompressed, copy all files in the decompressed folder to the source directory.repo/repoSubdirectory, and then execute repo init again, this time without the repo init commandrepo-urlThe parameters.

    And you’re done!

reference

  • git-repo
  • Microsoft Windows Details
  • Repo in Windows environment download Android source code
  • Window7 configuration download Android source code environment, install Repo