Build a git server in CentOS
Overview: Git is a distributed version control system. When using git, the client communicates with the server using the ssh protocol. The main advantage of using ssh is that it is fast (data is compressed before transmission, which is faster than HTTP), secure, and easy to read and write. There are two authentication methods for the client to access the server through ssh: one is the user name and password, and the other is the public/private key authentication method. It is convenient to use the public/private key. You do not need to enter the password for each login. The public key of a trusted client will be set on the server side ~ /. Ssh/authorized_keys file. For the format of this file, see the sshd user manual man sshd. An important function of authorized_keys is to support the command parameter. Every time you use this public key for verification, the user will execute the following command, so that you can perform some login-related logic processing.
1. Environment Description: the host of the operating system only has an intranet IP address and can access the Internet.
2. Install setuptools
A. wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
B. tar zxvf setuptools-0.6c11.tar.gz
C. cd setuptools-0.6c11
D. python setup. py build
E. python setup. py install
3. Clone and install gitosis
In any directory:
Git clone git: // github.com/res0nat0r/gitosis.git
Cd gitosis
Python setup. py install
So far, the git server software has been installed.
4. Create a server user (the user here refers to the user of the operating system, but this user is dedicated to managing git)
Su-c 'useradd retongame'
Su-c 'passwd retongame'
Enter the password.
5. Create a source code library
Su-retonGame (switch to the retonGame identity. Note that there are spaces before and after the minus sign)
Mkdir gameProj. git (create an empty source code library)
Cd gameProj. git/
Git -- bare init (initialize this empty source code library)
Ssh-keygen (generate ssh public key, standby)
When an ssh Public Key is generated, you must enter the name of the file that stores the public key, for example, enter aaa, and then enter the password used to encrypt the file, in the current situation, an aaa is generated. pub. The encrypted public key information is stored in the Yuci file.
So far, the server has been set up.
6. server usage (in Ubuntu)
Apt-get install git (install git. skip this step if it has been installed)
Git clone retonGame@192.168.10.133: gameProj. git
7. Access the git server from the Internet