A simple introduction to building your own repo server
This article is mainly used as a study note, and I also hope it can help other friends in need
First of all, thank you to the following Guidance for this article:
http://blog.csdn.net/hansel/article/details/9798189
http://blog.csdn.net/lb5761311/article/details/47723455
http://bbs.mfunz.com/thread-1015705-1-1.html
http://blog.csdn.net/sunweizhong1024/article/details/8055372
http://blog.csdn .net/itleaks/article/details/30021395?utm_source=tuicool&utm_medium=referral
Text--repo complete installation and project synchronization
1. Download repo bootstrap (repo Startup file for installing the complete repo)
- git clone git://git.omapzoom.org/git-repo.git
clone After completion, the repo bootstrap file is located in the following path:
- ./git-repo/repo
2. Install repo bootstrap
a. Create local repo
- mkdir ~/bin/
- cp ./git-repo/repo ~/bin/
b. Set environment variables:
- vi ~/.profile
Make sure there are the following three lines
- if [ -d "$HOME/bin" ] ; then
- PATH="$HOME/bin:$PATH"
- fi
c. Make the environment variables take effect
- source ~/.profile
Make the bin path take effect, and you can directly execute the command line repo in the future
3. patch repo bootstrap
- vi ~/bin/repo
Make changes according to the following diff
- -- REPO_URL = 'https://gerrit.googlesource.com/git-repo'
- REPO_URL = 'git://codeaurora.org/tools/repo.git'
This step must be done, otherwise in step 4, the repo URL download timeout problem will appear in the following log:
- fatal: Cannot get https ://gerrit.googlesource.com/git-repo/clone.bundle
- fatal: error [Errno 101] Network is unreachable
The timeout is because gerrit.googlesource.com was The wall is blocked
4. Create the project manifest, and the repo will synchronize the project with the configuration in the manifest
a. Create an empty manifest.git warehouse on the server, here it is as follows Take the remote url address as an example:
- cd manifest.git
- git remote -v
- origin git:manifest (fetch)
- origin git:manifest (push)
b. Clone the manifest repository on the client
- git clone git:manifest
c. Create the default.xml file. The repo will use the default.xml of the manifest warehouse as the configuration file by default
- cd manifest
- vi default.xml
Enter the following content:
-
- fetch="git:"
- review="https://android-review.googlesource.com/" / >
- remote="origin"
- sync-j="4" />
-
-
The manifest configuration is divided into three parts: remote default and project, which are explained separately
remote:
refers to a server address of the synchronization project (there can be multiple remotes)
name is A uniquely identifiable name
fetch is the prefix of the URL. In our example, the warehouse path is all git:XXX, so the prefix is "git:"
review can be ignored for the time being. In the example Whichever
default:
refers to the default server configuration used by the synchronization project:
revision refers to the name of the git branch
remote refers to the remote server used
sync-j means The number of parallel projects when synchronizing projects
project:
refers to the git warehouse of the synchronized project. Here we assume that we have a git:test warehouse (there can be multiple)
name is the git warehouse name test
Path is to set the directory where the warehouse is stored in the repo project. Here it is directly set to be stored in the test subdirectory of the repo project
d. Synchronize the modification of default.xml to the server
- git add default.xml
- git commit -m "udpate default.xml for repo sync test"
- git push origin master
5. Install the full version repo
a. First create and enter a custom directory:
- mkdir test-project
- cd test-project
b. Execute the following repo command to initialize the repo, and specify the mainfest project list
- repo init - u git:manifest
c. After execution, there will be the following log. Here is the real cloned full version of the repo:
- Get git://codeaurora.org/tools/repo.git
- remote: Counting objects: 3425, done.
- remote: Total 3425 (delta 0), reused 0 (delta 0)
- Receiving objects: 100% (3425/3425), 753.71 KiB, done.
- Resolving deltas: 100% (2311/2311), done.
- From git://codeaurora.org/tools/repo
- * [new branch] aosp-new/maint -> origin/aosp-new/maint
- * [new branch] aosp-new /master -> origin/aosp-new/master
- * [new branch] aosp-new/stable -> origin/aosp-new/stable
- * [new branch] caf-stable -> origin/caf-stable
- * [new branch] master -> origin/master
- * [new branch] stable -> origin/stable
- * [new tag] v1.0 -> v1.0
- * [new tag] v1.0.1 -> v1.0.1
- ......
- Getting manifest . ..
- from git:manifest
- remote: Counting objects: 18, done.
- remote: Compressing objects: 100% (16/16), done.
- remote: Total 18 (delta 4), reused 0 (delta 0)
- Unpacking objects: 100% (18/18), done.
- From git:manifest
- * [new branch] master -> origin/master
d. Next, you will be asked to initialize the repo account information. The example is consistent with git, for example, as follows, brackets is the git account information,
just enter the same information after the colon:
- Your Name [willqian]: willqian
- Your Email [690004467 @qq.com]: 690004467@qq.com
-
- Your identity is: willqian
- is this correct [y/n]? y
e. At this time, there will be a hidden folder .repo in the directory. The full version of the repo is located in the path
- .repo/repo/
6. repo synchronization project
a. Synchronization
- cd test-project
- repo After sync
is completed, you can see through the log that the test warehouse listed in the manifest project list has been cloned
We entered the test warehouse to view and found that there was a problem. no branch status
- cd test
- git status
- # Not currently on any branch.
- nothing to commit (working directory clean)
b. Cut to the master branch
- cd test-project
- repo start master --all
Through this operation, we entered the test warehouse again and saw that it was on the master branch
- cd test
- git status
- # On branch master
- nothing to commit (working directory clean)
At this point, the complete installation of the repo and the example of project synchronization To complete
http://www.bkjia.com/PHPjc/1075900.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1075900.htmlTechArticleBuilding your own repo server is a simple introduction. This article is mainly used as a study note, and I also hope it can help others. Friends in need would first like to thank the following articles for their guidance:...