gitlab building

First, install the Git
yum git the install
and configure:
the useradd --home / Home / git git
the passwd git
created user can switch to the git after the user's set back, such as a user name and a mail:
SU git
git config --global user.name "Somebody"
git config --global user.email "[email protected]"
set the default will be stored in ~ / .gitconfig file.
In this case, Git functions can already be used. To facilitate the operation of the back, you can create an empty repository.

mkdir ~ / repo
and then build the project directory

mkdir ~ / repo / huhamhire-hosts
to switch to the project directory, and initialized

~ cd / repo / huhamhire-hosts
git the init -bare
After completing this point, an initial empty project repository on the configuration, installed behind gitosis can push our code base content to the library.
Second, the installation gitosis
before installation, you can look at the implementation of the principle of gitosis:
http://geeklu.com/2012/10/gitosis/
to switch back to the root.

su root
and install python-setuptool

yum install python-setuptools
then begin installing gitosis, gitosis is worth noting that the installer itself is managed by the git, git is required to obtain. Here in the relevant mounting operation in / tmp:

cd / tmp
git clone https://github.com/res0nat0r/gitosis.git
then proceed to download the gitosis repository for installation:

gitosis cd
Python setup.py install
After installation is complete, you will enter the setup phase of the gitosis. Since gitosis need to be managed through SSH, you need to create an SSH key pair and a public key on the server side, the private key on the client. The general process is the client key has been created, the public reached into force on the server. However, if lazy direct problem is not large operating on the server.
Switch to git user and create a folder .ssh:

git su
mkdir /home/git/.ssh
must remember, is generated on the client's public key, uploaded to the server, or generated on the server and downloaded to the client.
Entering ~ / .ssh directory and generate a public key using ssh-keygen:

/home/git/.ssh cd
SSH-keygen -t rsa
careful not to forget the private key password. The default will generate ~ / .ssh / id_rsa.pub public key file.
With key can be initialized after gitosis, the gitosis gain administrative privileges to the Git:

gitosis-init </home/git/.ssh/id_rsa.pub
After initialization, the project will create gitosis-admin.git in / home / git / repositories, can be configured to gitosis by maintaining this project.
In addition, we also need to gitosis-admin.git / hooks / post- update directory conferred on the special privileges:

chmod u + x /home/git/repositories/gitosis-admin.git/hooks/post-update
Thus, gitosys server configuration is completed.
Third, set up and use gitosys
after completion of gitosys on the server side configuration, you can perform the following settings on the client to use Git server.
More formal approach is to do it in the client management through gitosis-admin repository, and then submitted to the server so that the project authority to take effect, of course, you can use ssh login to verify the operating system, but here only introduces a method described above.
During the following, you need to confirm that your public key is not already on the client machine at ~ / .ssh / directory. If you are using github, then you need to set up something more public coexistence. .ssh / config, write in this document:
Host github.com
HostName github.com
the User git
IdentityFile C: /Users/abc/.ssh/id_rsa
Host git.oschina.net
HostName git.oschina.net
the User git
IdentityFile C : /Users/abc/.ssh/id_rsa_a
Host abc.ueder.info
HostName abc.ueder.info
the User git
Port 1000
IdentityFile C: /Users/abc/.ssh/id_rsa_new
as I use several git services, each with its own public key, you need to distinguish the configuration file, and my own server ssh port is not the default port , you need to declare in the configuration file, otherwise each clone's time to declare the port.
Download gitosis-admin repository on the client machine, here to linux client, for example:
git clone git @ VPS's IP / Domain: /home/git/repositories/gitosis-admin.git
acquired after the completion of the gitosis-admin / gitosis. conf file settings to the new project as an example above, add:
[Group huhamhire-hosts]
Writable = huhamhire-hosts
Members = hamhire @ myhost
under then set the client's public key to keydir directory, and then set to submit server:
CP ~ / .ssh / id_rsa.pub ~/gitosis-admin/keydir/[email protected]

CD ~ / Gitosis-ADMIN
Git the Add ./
Git the commit -a -m "the repo the Add new new"
Git Push
due to the previous provided repository location huhamhire-hosts at / home / git / repo / directory, a push operation can be performed directly.
/ Home / git / repo path / huhamhire-hosts to submit the project: in the present example by hamhire @ myhost.
At this point, gitosys configuration completed.
Fourth, the installation gitweb
later in the git server configuration is complete, if need convenient online viewing, use gitweb to provide a simple Web version of the display interface version is a good choice.
In centos gitweb mounted below:
yum the install fcgi devel-

CD / usr / local / the src /
Git clone Git: //github.com/gnosek/fcgiwrap.git
CD fcgiwrap
the autoreconf -i
./configure
the make
the make the install
point, fcgiwrap has installation to / usr / local / sbin / fcgiwrap
then install fcgi-spawn
yum install spawn-fcgi
after installation:
vim / etc / sysconfig / spawn-fcgi
modify the file is:
# the SET by You the MUST some the before at the Working Options "spawn- fcgi "by Will Work Service.
# Points to the If SOCKET A File, the then the this File at The IS Cleaned up by the init Script.
#
# See spawn-fcgi (1) for All Possible Options.
#
# Example :
#SOCKET=/var/run/php-fcgi.sock
#OPTIONS="-u apache -g apache -s $SOCKET -S -M 0600 -C 32 -F 1 -P /var/run/spawn-fcgi.pid -- /usr/bin/php-cgi"
FCGI_SOCKET=/var/run/fcgiwrap.socket
FCGI_PROGRAM=/usr/local/sbin/fcgiwrap
FCGI_USER=nginx
FCGI_GROUP=nginx
FCGI_EXTRA_OPTIONS="-M 0700"
OPTIONS="-u $FCGI_USER -g $FCGI_GROUP -s $FCGI_SOCKET -S $FCGI_EXTRA_OPTIONS -F 1 -P /var/run/spawn-fcgi.pid -- $FCGI_PROGRAM"
然后设置开机运行:

2345 --levels spawn-fcgi chkconfig ON
/etc/init.d/spawn-fcgi Start
here have completed the installation and operation of fcgi. If you're using nginx, nginx.conf also need to be configured to forward the request to .cgi fcgiwrap.socket
LOCATION / cgi-bin / {
# Disable gzip (IT Makes scripts Feel It would help to Complete Operating since They have have
# the before the Getting gzipped)
gzip OFF;
# the Set at The root to / usr / lib (Inside the this means that the this LOCATION WE are
# Files at The Giving Access to an under / usr / lib / cgi-bin)
root /var/www/www.example.com ;
# Fastcgi Socket
fastcgi_pass UNIX: /var/run/fcgiwrap.socket;
# Fastcgi Parameters, The Standard ones the include
the include / etc / Nginx / fastcgi_params;
# the Adjust Parameters non Standard (SCRIPT_FILENAME)
SCRIPT_FILENAME $ DOCUMENT_ROOT $ fastcgi_script_name fastcgi_param;
}
final restart nginx on it.

Guess you like

Origin www.cnblogs.com/li0920/p/12072548.html