Configure the repo server in Ubuntu

Source: Internet
Author: User
Tags ssh keygen

I 've been pulling code from the company's server using repo sync. Today, I'm empty. I also want to try setting up a repo server on my local machine.

I searched for a bunch of tutorials online... Many of them are copy files. After a long time, they have finally succeeded. Ubuntu12.04.


1. I have written an article about building a git server on the local machine. At that time, I needed to add the SSH keygen information of the client to the server before the client can be accessed. This time, with the help of Git-daemon, after the configuration, the external client can be accessed. First install Git-daemon in Ubuntu: (I have installed git before)

$ Sudo apt-Get install Git-daemon


2. Create a folder reposerver in the main directory and enter:

$ Mkdir/home/ritterliu/reposerver

$ CD/home/ritterliu/reposerver


3. Create manifest. Git to store the XML file on which the repo download code is based:

$ Git init -- bare manifest. Git


4. Now you can copy the project managed by git that you want to share to this directory. For example, I copied angrybird5 and dlna in my eclispe workspace to this directory:

$ CP-r/work/workspace/angrybird5.

$ CP-r/work/workspace/dlna.

Note that both projects must be managed by git and submitted. You can also enter the project and execute git init, git add, and git commit operations.


5. Now let's put down this directory and configure the execution path of Git-daemon. The root permission is required:

$ Sudo Su

# Vi/etc/SV/Git-daemon/run

Configure the/etc/SV/Git-daemon/run file as follows:

#! /Bin/sh
Exec 2> & 1
Echo 'git-daemon starting .'
Exec chpst-ugitdaemon \
"$ (GIT -- Exec-path)"/Git-daemon -- verbose -- export-all -- Base-Path =/home/ritterliu/

PS: parameter: -- enable = receive-pack can increase the push permission of anonymous users (to be verified ).

Restart Git-daemon:

# SV restart Git-daemon



6. Clone manifest. Git from any other directory. If it is empty, a blank manifest folder will be cloned:

$ Mkdir/home/ritterliu/clone

$ CD/home/ritterliu/clone

$ Git clone ritterliu@127.0.0.1:/home/ritterliu/reposerver/manifest. Git


7. Enter the manifest folder and create the following default. xml file:

$ VI default. xml

<? XML version = "1.0" encoding = "UTF-8"?>
<Manifest>
<Remote name = "Korg" Fetch = "Git: // 192.168.10.1/reposerver" Review = "review.source.android.com"/>
<Default revision = "master" remote = "Korg"/>
<Project Path = "angrybird5" name = "angrybird5"/>
<Project Path = "dlna" name = "dlna"/>
</Manifest>

Here, fetch = "Git: // 192.168.10.1/reposerver fill in the local IP address, the project is just added in/home/ritterliu/reposerver to the project to be shared.

The subsequent operations are git add, git commit, and git push. Remember git push to push the added default. xml changes to manefest. Git:

$ Git add.

$ Git commit-a-m "add default. xml"

$ Git push origin master


8. Now, the server is fully configured. Go to another host, create a folder, download Repo, and execute repo init:

$ Mkdir/home/Ubuntu/download

$ CD/home/Ubuntu/download

curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > repo

$ Chmod + x Repo

$./Repo init-u git: // 192.168.10.1/reposerver/manifest. Git

In this case, if fatal: Unable to connect a socket (connection refused) occurs, the path is usually configured in Git-daemon or default. xml.

Finally, synchronize the following code:

$./Repo sync

If error: Revision master in angrybird5 not found occurs, it should be because the project has not been commit.

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.