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