Ubuntu11.10Server install Git Server

Source: Internet
Author: User
It takes some time to configure the Git server and client. As before, it is still based on the latest Ubuntu11.10server/desktop system. Note: Git is a distributed management tool, so there is no real Server. This article uses three machines, S1 representing Ubuntu11.10serverC1 in the data center representing the first ubuntu1_topc2 with administrative permissions.

It takes some time to configure the Git server and client. As before, it is still based on the latest Ubuntu11.10 server/desktop system.

Note: Git is a distributed management tool, so there is no real Server. This article uses three machines, which are

S1 represents the Ubuntu 11.10 server in the IDC

C1 represents the first Ubuntu desktop with administrative permissions

C2 represents the later added Ubuntu desktop with management Permissions

All three machines can be considered as servers. From the perspective of convenience, project files are always submitted to S1, and the latest project files are obtained from S1.

1. Install the Git service program on Ubuntu server

This Ubuntu server is called S1

[Plain]
  1. Sudo apt-get install git-core
2. Install the Gitosis program on S1.

Gitosis is a tool program that can help us with Git repository access control and remote management.

[Plain]
  1. Sudo apt-get install python-setuptools
  2. Mkdir ~ /Src
  3. Cd ~ /Src
  4. Git clone git: // eagain.net/gitosis.git
  5. Cd gitosis
  6. Sudo python setup. py install

3. Create a git account on S1.

No password. This account is used by the Gitosis program.

[Plain]
  1. Sudo adduser \
  2. -- System \
  3. -- Shell/bin/sh \
  4. -- Gecos 'git version control '\
  5. -- Group \
  6. -- Disabled-password \
  7. -- Home/git \
  8. Git

4. Install the remote management client

The first remote management client is called C1.

[Plain]
  1. Sudo apt-get install openssh-client
  2. Ssh-keygen
If openssh-client is not installed, the first line of command is required. The ssh-keygen command creates a public key and a private key file. Copy the public key file to the server. After being imported to Gitosis on S1, C1 can connect to the server through SSH without the user name and password.

[Plain]
  1. Scp/home/chenshu/. ssh/id_rsa.pub cncm @ S1:/home/cncm
  2. Sudo-H-u git gitosis-init
The following result is displayed:

Initialize empty Git repository in/home/git/repositories/gitosis-admin.git/
Reinitialized existing Git repository in/home/git/repositories/gitosis-admin.git/

It means that the repository directory has been successfully created on S1. The path is/home/git/repositories, and an administrator repository named gitosis-admin is also created.


Modify the permissions of a file on S1:

[Plain]
  1. Sudo chmod 755/home/git/repositories/gitosis-admin.git/hooks/post-update

Clone the gitosis-admin repository From S1 to C1:

[Plain]
  1. /Home/chenshu/my_git
  2. Cd ~ /My_git
[Plain]
  1. Git clone git @ S1: gitosis-admin.git
  2. Cloning into gitosis-admin...
  3. Remote: Counting objects: 5, done.
  4. Remote: Compressing objects: 100% (4/4), done.
  5. Remote: Total 5 (delta 1), reused 5 (delta 1)
  6. Grouping objects: 100% (5/5), done.
  7. Resolving deltas: 100% (1/1), done.

Now you can remotely manage the repository on S1 by modifying the gitosis-admin/gitosis. conf file:

[Plain]
  1. [Gitosis]
  2. [Group gitosis-admin]
  3. Members = chenshu @ chenshu-System-Product-Name
  4. Writable = gitosis-admin

The above is automatically created when gitosis initialized the public key imported into C1. The C1 user has been added to the Administrator.

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.