1. Install Git on the server
Use ssh to log on to the server and install git
Yum install git
"No package git available. Nothing to do" error occurs during installation.
You must first add the EPEL (Extra Packages for Enterprise Linux) repository:
CentOS5.x 32-bit (x86/i386): rpm-Uvh http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm CentOS5.x 64-bit (x64): rpm-Uvh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm CentOS6.x32-bit (x86/i386 ): rpm-Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-5.noarch.rpm CentOS6.x 64-bit (x64): rpm-Uvh http://download.fedoraproject.org/pub/e Pel/6/x86_64/epel-release-6-5.noarch.rpm and then yum install git will be able to install.
Install the corresponding EPEL according to the centos version
Cat/etc/redhat-release View system version
2. Install gitosis on the server
Sudo yum install python-setuptoolscd/usr/local/srcgit clone git: // github.com/res0nat0r/gitosis.gitcd gitosispython setup. py install
3. Generate a key on the local machine and upload the public key to the server.
Ssh-keygen-t rsa # enter without a password
# Upload the public key to the server (default SSH port 22) scp ~ /. Ssh/id_rsa.pub root @ server IP:/tmp
4. Return to the server and initialize gitosis.
# Create git version management User gitsudo adduser git # change git
User password
Sudo passwd git # su to git User su? Gitgitosis-init </tmp/id_rsa.pub # The following information is displayed indicating success # Initialized empty Git repository in/home/git/repositories/gitosis-admin.git/# Reinitialized existing Git repository in/home/git /repositories/gitosis-admin.git/# Delete key rm-rf/tmp/id_rsa.pub
5. Export the gitosis project on the local machine
Mkdir-p/repo # p level create directory cd/repogit clone git @ server IP: gitosis-admin.gi
6. Add other team members
Ls keydir: only your own public key file is displayed.
Generate, upload, or copy the process in step 1 to this directory.
Copy the data in the id_rsa.pub file of the codeveloper to the key username. pub file of the corresponding developer. For example, paste the text in the id_rsa.pub file of the key username guangyun.ni@yeepay.com into the guangyun.ni@yeepay.com.pub file and save
Vim gitosis. conf
[Gitosis] [group gitosis-admin] writable = gitosis-adminmembers = winstar@Josh.local # when multiple users in the group (key username) are collaboratively developed, separate [group renhetest] writable = renhetestmembers = winstar@Josh.localrenhetest is my new test project, writable with git project name # submit modify git add. git commit-a-m "add test-git repo" git push
Initialize the renhetest test project
Cd ~ /Repomkdir renhetestcd renhetestgit inittouch readme.txt git add. git commit-a-m "init test-git" git remote add origin git @ ServerIp: test-git.gitgit push origin master
Now, the installation configuration and project configuration test will be done well. Please try it without your defense.