Use gitosis in centos to build a git code repository

Source: Internet
Author: User

Centos has been tossing for half a month and the environment has been configured. This git is especially troublesome.

First, we will explain that the target system is centos. If other systems do not know it, we will be responsible for the consequences!

Install git

 

 
$ Wget http://kernel.org/pub/software/scm/git/git-1.7.2.3.tar.gz $ tar-xzvf git-1.7.2.3,tar.gz $ CD git-1.7.2.3 $. /configure -- With-curl =/usr/local $ make & make install $ git -- version # Check the version number. Check whether git is successfully installed.

 

Install gitosis

 
$ Yum install Python-Setuptools
$ Git clone git://Eagain.net/gitosis.git
$ CD gitosis
$ Python setup. py install

 

Generate a public key on the development machine (used to initialize gitosis)

 

 
$ SSH-Keygen-T DSA # password not required, just press ENTER
$ SCP~ /. SSH/Id_rsa.pub root @ xxx:/TMP/# Upload your SSHPublicKey to the server

 

Initialize gitosis

 

$ Adduser git # automatically generated/Home/Git/Directory and git Group
$ Su-Git # switch to a git user
$ Gitosis-Init< /TMP/Id_dsa.pub
$ RM/TMP/Id_rsa.pub # id_rsa.pub is useless and can be deleted.

 

Get and configure gitosis-Admin:

 

Code

 
$ Git clone git@someServer.com: gitosis-Admin. Git # Run the command locally to obtain the gitosis management project
$ VI gitosis-Admin/Gitosis. conf # edit gitosis-Admin configuration file

[Group group name]
Writable=Project name
Members=User # the username here must be the same as the file name in keydir

 

Next, you can initialize your local project and submit the GIT server.

 

Code

  $ Rails  New  DEMO # Use rails3 as an Example
$ CD demo && Vi. gitignore #. gitignore can ignore unnecessary files, such as database. yml and gemfile. Lock.

This is an example:
. Bundle
DB /* . Sqlite3
Log/*. Log
TMP /* */ *
. Rvmrc
Config / Database. yml
Gemfile. Lock
Gemfile. Local

$ Git init
$ Git add.
$ Git commit - A - M " Initial Import "
$ Git remote add origin git@yourserver.com: projectname. Git
$ Git push origin master

More articles about rials

 

 

Related Article

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.