Create a local mirror library for Android)

Source: Internet
Author: User

1. Install repo

    $ mkdir ~/bin    $ echo "export PATH=~/bin:\$PATH" >> ~/.bashrc    $ source ~/.bashrc
Obtain repo and grant executable permissions (or refer to the official google website)
    $ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo    $ chmod a+x ~/bin/repo

2. Create a local version Library

    $ mkdir -p /work/git/android    $ cd /work/git/android    $ repo init -u https://android.googlesource.com/mirror/manifest --mirror    $ repo sync -j8

3. Create a local version library git access method

Install git-daemon

    $sudo apt-get install git-daemon-run

Modify configurations

    $sudo vi /etc/sv/git-daemon/run
Put the last line in the file:
    "$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache /var/cache/git
To:
    "$(git --exec-path)"/git-daemon --verbose --export-all --base-path=/work/git/ /work/git/
The final result is as follows:
    #!/bin/sh    exec 2>&1    echo 'git-daemon starting.'    exec chpst -ugitdaemon \      "$(git --exec-path)"/git-daemon --verbose --export-all --base-path=/work/git/ /work/git/     #  "$(git --exec-path)"/git-daemon --verbose --base-path=/var/cache /var/cache/git
Restart the git-daemon Service
    $sudo sv stop git-daemon    $sudo sv start git-daemon
Check whether the service is started
    $sudo ps aux | grep "git"

4. Use the local version Library (the server address is 192.168.1.183)

Access and use through git (you have installed and configured the repo by default ):

    $ repo init -u git://192.168.1.183/android/platform/manifest.git --repo-url=git://192.168.1.183/android/platform/tools/repo.git
Or a specified version
    $ repo init -u git://192.168.1.183/android/platform/manifest.git -b android-4.1.1_r2 --repo-url=git://192.168.1.183/android/platform/tools/repo.git
Access the local directory on 192.168.1.183:
    repo init -u /work/git/android/platform/manifest.git --repo-url=/work/git/android/platform/tools/repo.git
Or a specified version
    repo init -u /work/git/android/platform/manifest.git  -b android-4.1.1_r2 --repo-url=/work/git/android/platform/tools/repo.git
Refer to the official google website.

By Leslie Guan

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.