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