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
- [Root @ localhost ~] # Rpm-q git
If not, install
[Plain]View plaincopy
- [Root @ localhost ~] # Yum install git
After the installation is complete, test whether the installation is successful.
[Plain]View plaincopy
- [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
- [Dengsilinming @ localhost ~] $ Sudo useradd-m git
- [Dengsilinming @ localhost ~] $ Sudo passwd git
Create a git repository Directory
[Plain]View plaincopy
- [Dengsilinming @ localhost ~] $ Sudo mkdir/home/git/repositories
Set git repository permissions
[Plain]View plaincopy
- [Dengsilinming @ localhost ~] $ Sudo chown git: git/home/git/repositories
- [Dengsilinming @ localhost ~] $ Sudo chmod 755/home/git/repositories
Initialize global settings
[Plain]View plaincopy
- [Root @ localhost ~] # Git config -- global user. name "linming"
- [Root @ localhost ~] # Git config -- global user. email linming@126.com
Install the python setup tool
[Plain]View plaincopy
- [Root @ localhost ~] # Yum install python-setuptools
- [Dengsilinming @ localhost gitosis] $ git clone git: // eagain.net/gitosis.git
If
[Plain]View plaincopy
- Eagain.net [0: 208.78.102.120]: errno = Connection refused
- 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
- [Dengsilinming @ localhost tmp] $ git clone https://github.com/res0nat0r/gitosis.git
After the download is successful:
[Plain]View plaincopy
- [Dengsilinming @ localhost tmp] $ cd gitosis
- [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
- [Dengsilinming @ localhost gitosis] $ ssh-keygen-t rsa # always press Enter.
- [Dengsilinming @ localhost gitosis] $ scp ~ /. Ssh/id_rsa.pub/tmp/& chmod a + r/tmp/
- [Dengsilinming @ localhost gitosis] $ su git
- [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
- [Root @ localhost ~] # Chmod 755/home/git/repositories/gitosis-admin.git/hooks/post-update
Now the server has been built.