1. Configure Repo
1.1 Downloads Git-repo.git (b-side)
Mkdir-p ~/gitcfgcd ~/gitcfggit Clone Https://gerrit.googlesource.com/git-repo git-repo.git
If the above address cannot be connected, try the following address:
git clone Https://review.mfunz.com/git-repo git-repo.git
1.2 Configuring repo (b-terminal)
A) Copy the repo from the Git-repo.git directory to the/usr/bin:
CD Git-repo.gitsudo CP Repo/usr/bin/repo_gitadmin
b) Modify Repo
Vi/usr/bin/repo_gitadmin
Modify
Repo_url = ' Https://gerrit.googlesource.com/git-repo ' Repo_rev = ' stable '
For
Repo_url =/home/gitadmin/gitcfg/git-repo.gitrepo_rev = ' master '
which
Repo_url:repo the called Library and the management reference warehouse;
Repo_rev: This article sets the branch to master and can go to git-repo.git with the command git branch view:
CD Git-repo.gitgit BRANCH-AVV
2. Create a version root (end a)
2.1 If the/home/git/repositories directory already exists, you do not need to create it, otherwise:
sudo su gitcd/home/gitmkdir repositories
2.2 Initializing the Manifest warehouse
CD repositoriesgit Init--bare 17435/manifest.git
3. Configuring the Default.xml file (end b)
Default.xml is compatible with Android code, you can refer to the Google Android source repo (. repo/manifests/default.xml) for modification.
3.1 Cloning Manifest.git
MKDIR/HOME/GITADMIN/17435CD /home/gitadmin/17435git Clone [email Protected]:17435/manifest.gitcd manifest.git
3.2 Configuring Default.xml
VI Default.xml
This article is configured as follows:
<?xml version= "1.0" encoding= "UTF-8"?><manifest> <remote Name= "origin" fetch= "git:// 192.168.1.126 "/> <default revision=" master " Remote=" origin " sync-j=" 4 "/> <project Path= "Build" Name= "Platform/build" groups= "PDK" > <copyfile src= "core/root.mk" dest= "Makefile"/> </project> <project path= "abi/cpp" name= "Platform/abi/cpp" groups= "PDK"/> ... </ Manifest>
Push the Default.xml file above to the warehouse:
git Add. Git commit-m "Init commit" git push or git push--all
4. Build the associated git repository (a-side)
4.1 Get the list of warehouse catalogs that need to be created
Cd/home/git/repositories/17435cat Default.xml | Cut-d ' "'-F 4 > Repos_17435.txt
Delete unnecessary lines in repos_17435.txt, such as manifest, makefile, etc.
4.2 New Script Repos_17435.sh
#/bin/bashset-xset-epwd=${pwd}cd/home/git/repositories/17435while read line; Do if [-Z ' $line]; then echo $work _dir not exist!!!!!!!!!! 1>&2 continue fi git init--bare $line. Git echo = = $line pwddone
4.3 Create a new warehouse with the following command
Cat Repos_17435.txt |. repos_17435.sh
5. Upload code to warehouse (b-side)
5.1 Copy Android code to directory,
/home/gitadmin/17435/src
and remove versioning information like Git and SVN.
5.2 The Repository directory to be uploaded via Default.xml is saved in Src_17435.txt
Cd/home/gitadmin/17435/srccat/home/gitadmin/17435/manifest.git/default.xml | Cut-d ' "'-F 2 > Src_17435.txt
Edit Src_17435.txt to clear unnecessary rows.
5.3 The new script src_17435.sh is as follows:
#/bin/bashset-xset-epara1=work_dir=$1pwd=${pwd}while read line; Do line1=${line%%/*} if [-Z ' $line]; then echo $work _dir not exist!!!!!!!!!!!! 1>&2 continue< C4/>fi If [$ (ls-a $pwd/$line | wc-l)-EQ 0]; then echo $work _dir empty!!!!!!!!!!!! 1>&2 continue
fi workdir= $pwd/$line echo = = = = $workdir cd $workdir rm-rf. Git git init. 1>&2 git Add.-F 1>&2 git commit-m "Initial commit" 1>&2 if ["$line 1" = "Device"]; Then git push--set-upstream git://192.168.1.126/17435/$line. Git master elif ["$line 1" = "Vendor"]; Then
git push--set-upstream git://192.168.1.126/17435/$line. Git master else git push--set-upstream git:// 192.168.1.126/17435/platform/$line. Git master fi Cd-done
5.4 Upload the code to the repository using the following command:
Cat Src_17435.txt |. src_17435.sh
6. Download the Code
Mkdir-p/home/gitadmin/17435/descd/home/gitadmin/17435/desrepo_gitadmin init-u git://192.168.1.126/17435/ Manifest.git
Repo_gitadmin sync-f-j4
Ubuntu build Repo Server (iii): Build Android Repo server