Set up git server gitosis under CentOS6.2

Source: Internet
Author: User
1. install git first check if [plain] viewplaincopy [root @ localhost ~] has been installed in git # Rpm-qgit & nbs 1. install git
Check if git has been installed [Plain]View plaincopy
  1. [Root @ localhost ~] # Rpm-q git
If not, install [Plain]View plaincopy
  1. [Root @ localhost ~] # Yum install git

After the installation is complete, test whether the installation is successful.

 

[Plain]View plaincopy
  1. [Root @ localhost ~] # Git -- version

 

If the following information is displayed, the installation is successful.
Git version 1.7.1

2. set the git server

Create a git server to manage users

[Plain]View plaincopy
  1. [Dengsilinming @ localhost ~] $ Sudo useradd-m git
  2. [Dengsilinming @ localhost ~] $ Sudo passwd git

Create a git repository Directory

[Plain]View plaincopy
  1. [Dengsilinming @ localhost ~] $ Sudo mkdir/home/git/repositories
Set git repository permissions
[Plain]View plaincopy
  1. [Dengsilinming @ localhost ~] $ Sudo chown git: git/home/git/repositories
  2. [Dengsilinming @ localhost ~] $ Sudo chmod 755/home/git/repositories
Initialize global settings [Plain]View plaincopy
  1. [Root @ localhost ~] # Git config -- global user. name "linming"
  2. [Root @ localhost ~] # Git config -- global user. email linming@126.com
Install the python setup tool [Plain]View plaincopy
  1. [Root @ localhost ~] # Yum install python-setuptools
  2. [Dengsilinming @ localhost gitosis] $ git clone git: // eagain.net/gitosis.git
If [Plain]View plaincopy
  1. Eagain.net [0: 208.78.102.120]: errno = Connection refused
  2. Fatal: unable to connect a socket (Connection refused)
Download unavailable (this occurs because the proxy is not configured on the Internet). please try: [Plain]View plaincopy
  1. [Dengsilinming @ localhost tmp] $ git clone https://github.com/res0nat0r/gitosis.git
After the download is successful: [Plain]View plaincopy
  1. [Dengsilinming @ localhost tmp] $ cd gitosis
  2. [Dengsilinming @ localhost gitosis] $ sudo python setup. py install
Generate a public key on the development machine (the user on the development machine acts as the git server administrator)
[Plain]View plaincopy
  1. [Dengsilinming @ localhost gitosis] $ ssh-keygen-t rsa # always press Enter.
  2. [Dengsilinming @ localhost gitosis] $ scp ~ /. Ssh/id_rsa.pub/tmp/& chmod a + r/tmp/
  3. [Dengsilinming @ localhost gitosis] $ su git
  4. [Dengsilinming @ localhost gitosis] $ sudo-H-u git gitosis-init </tmp/id_rsa.pub
Gitosis manages configuration files through a git repository, which is placed in/home/git/repositories/gitosis-admin.git. We need to add executable permissions to a file:
[Plain]View plaincopy
  1. [Root @ localhost ~] # Chmod 755/home/git/repositories/gitosis-admin.git/hooks/post-update
Now the server has been built.

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.