Home > Backend Development > PHP Tutorial > A simple introduction to building your own repo server_PHP tutorial

A simple introduction to building your own repo server_PHP tutorial

WBOY
Release: 2016-07-12 09:04:00
Original
1359 people have browsed it

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)

  1. git clone git://git.omapzoom.org/git-repo.git
clone After completion, the repo bootstrap file is located in the following path:

  1. ./git-repo/repo


2. Install repo bootstrap

a. Create local repo

  1. mkdir ~/bin/
  2. cp ./git-repo/repo ~/bin/

b. Set environment variables:

  1. vi ~/.profile
Make sure there are the following three lines

  1. if [ -d "$HOME/bin" ] ; then
  2. PATH="$HOME/bin:$PATH"
  3. fi

c. Make the environment variables take effect

  1. source ~/.profile
Make the bin path take effect, and you can directly execute the command line repo in the future


3. patch repo bootstrap

  1. vi ~/bin/repo
Make changes according to the following diff

  1. -- REPO_URL = 'https://gerrit.googlesource.com/git-repo'
  2. 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:

  1. fatal: Cannot get https ://gerrit.googlesource.com/git-repo/clone.bundle
  2. 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:

  1. cd manifest.git
  2. git remote -v
  3. origin git:manifest (fetch)
  4. origin git:manifest (push)

b. Clone the manifest repository on the client

  1. 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

  1. cd manifest
  2. vi default.xml
Enter the following content:



  1. fetch="git:"
  2. review="https://android-review.googlesource.com/" / >
  3. remote="origin"
  4. 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

  1. git add default.xml
  2. git commit -m "udpate default.xml for repo sync test"
  3. git push origin master


5. Install the full version repo

a. First create and enter a custom directory:

  1. mkdir test-project
  2. cd test-project

b. Execute the following repo command to initialize the repo, and specify the mainfest project list

  1. repo init - u git:manifest

c. After execution, there will be the following log. Here is the real cloned full version of the repo:

  1. Get git://codeaurora.org/tools/repo.git
  2. remote: Counting objects: 3425, done.
  3. remote: Total 3425 (delta 0), reused 0 (delta 0)
  4. Receiving objects: 100% (3425/3425), 753.71 KiB, done.
  5. Resolving deltas: 100% (2311/2311), done.
  6. From git://codeaurora.org/tools/repo
  7. * [new branch] aosp-new/maint -> origin/aosp-new/maint
  8. * [new branch] aosp-new /master -> origin/aosp-new/master
  9. * [new branch] aosp-new/stable -> origin/aosp-new/stable
  10. * [new branch] caf-stable -> origin/caf-stable
  11. * [new branch] master -> origin/master
  12. * [new branch] stable -> origin/stable
  13. * [new tag] v1.0 -> v1.0
  14. * [new tag] v1.0.1 -> v1.0.1
  15. ......
  16. Getting manifest . ..
  17. from git:manifest
  18. remote: Counting objects: 18, done.
  19. remote: Compressing objects: 100% (16/16), done.
  20. remote: Total 18 (delta 4), reused 0 (delta 0)
  21. Unpacking objects: 100% (18/18), done.
  22. From git:manifest
  23. * [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:

  1. Your Name [willqian]: willqian
  2. Your Email [690004467 @qq.com]: 690004467@qq.com
  3. Your identity is: willqian
  4. 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

  1. .repo/repo/


6. repo synchronization project

a. Synchronization

  1. cd test-project
  2. 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

  1. cd test
  2. git status
  3. # Not currently on any branch.
  4. nothing to commit (working directory clean)

b. Cut to the master branch

  1. cd test-project
  2. repo start master --all
Through this operation, we entered the test warehouse again and saw that it was on the master branch

  1. cd test
  2. git status
  3. # On branch master
  4. nothing to commit (working directory clean)


At this point, the complete installation of the repo and the example of project synchronization To complete

www.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:...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template