Set up git server gitosis under CentOS6.2
1. Install git
Check whether [plain] view plaincopy has been installed in git.
- [Root @ localhost ~] # Rpm-qgit
If not, install [plain] view plaincopy.
- [Root @ localhost ~] # Yuminstallgit
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 ~] $ Sudouseradd-mgit
- [Dengsilinming @ localhost ~] $ Sudopasswdgit
Create a git repository directory
[Plain] view plaincopy
- [Dengsilinming @ localhost ~] $ Sudomkdir/home/git/repositories
Set git repository Permissions
[Plain] view plaincopy
- [Dengsilinming @ localhost ~] $ Sudochowngit: git/home/git/repositories
- [Dengsilinming @ localhost ~] $ Sudochmod755/home/git/repositories
Initialize global settings [plain] view plaincopy
- [Root @ localhost ~] # Gitconfig -- globaluser. name "linming"
- [Root @ localhost ~] # Gitconfig--globaluser.emaillinming@126.com
Install python's setup tool [plain] view plaincopy
- [Root @ localhost ~] # Yuminstallpython-setuptools
- [Dengsilinming @ localhostgitosis] $ gitclonegit: // eagain.net/gitosis.git
If [plain] view plaincopy appears
- Eagain.net [0: 208. 78.102.120]: errno = Connectionrefused
- Fatal: unabletoconnectasocket (Connectionrefused)
Unable to download (This occurs because the proxy is not configured online) Please try: [plain] view plaincopy
- [Dengsilinming @ localhosttmp] $ gitclonehttps: // github.com/res0nat0r/gitosis.git
After the download is successful: [plain] view plaincopy
- [Dengsilinming @ localhosttmp] $ cdgitosis
- [Dengsilinming @ localhostgitosis] $ sudopythonsetup. pyinstall
Generate a public key on the development machine (the user on the development machine acts as the git server administrator)
[Plain] view plaincopy
- [Dengsilinming @ localhostgitosis] $ ssh-keygen-trsa # always press Enter.
- [Dengsilinming @ localhostgitosis] $ scp ~ /. Ssh/id_rsa.pub/tmp/& chmoda + r/tmp/
- [Dengsilinming @ localhostgitosis] $ sugit
- [Dengsilinming @ localhostgitosis] $ sudo-H-ugitgitosis-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 ~] # Chmod755/home/GitHub/repositories/gitosis-admin.git/hooks/post-update
Now the server has been built.