CentOS 6.4 Build a git server (2013-11-22 19:04:09) Reprint Tags: It classification: Linux This file is written according to Markdown, better results see my github documentation https://github.com/ Jackliu2013/recipes/blob/master/doc/linux/centos_6.4_git server Setup. md# #CentOS安装Git服务器 CentOS 6.4 + Git 1.8.2.2 + gitosis## 1. View Linux System Server System version ' Cat/etc/redhat-release # View system version CentOS release 6.4 (Final) ifconfig # View server IP eth0 Link encap:ethernet HWaddr 00:23:8b:fa:78:92 inet addr:192.168.100.202 bcast:192.168.100.255 mask:255.255.255.0 inet6 addr:fe80::223:8bff:fefa:7892/64 scope:link up BROADCAS T RUNNING multicast mtu:1500 metric:1 RX packets:543645 errors:0 dropped:0 overruns:0 frame:0 TX packets:157155 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:38352737 9 (365.7 MiB) TX bytes:13270106 (12.6 MiB) Interrupt:16lo Link encap:local Loopback inet Addr: 127.0.0.1 mask:255.0.0.0 Inet6 Addr::: 1/128 scope:host up LOOPBACK RUNNING mtu:16436 metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) "2. Install git on the server and do something-execute command ' sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-de Vel '-Download the git-1.8.2.2.tar.gz file at the same time and then send it ' mv ' to the '/usr/local/src ' directory. [Git-1.8.2.2.tar.gz installation package] [1] ' Cd/usr/local/srcsudo tar-zvxf git-1.8.2.2.tar.gzcd git-1.8.2.2sudo make Prefix=/usr/local/git Allsudo make Prefix=/usr/local/git Install '-Add soft connect ' ' sudo ln-s/usr/local/git/bin/*/usr/bin/git--version #如果能显示版本号, that means success ' ' 3. Install gitosis "sudo yum install python python-setuptoolscd/usr/local/srcgit clone git://github.com/res0nat0r/on the server GITOSIS.GITCD gitosispython setup.py Install #显示Finished processing dependencies for gitosis==0.2 means success ' 4. On the development machine, Production key and upload to Server "' ssh-keygen-t RSA #一路回车, no need to set password # Upload public key to server (default SSH port 22SCP ~/.ssh/id_rsa.pub [email protected]100.202:/tmp ' or edit '/etc/hosts ' file, add the following text to the '/etc/hosts ' file: ' # Local git server192.168.100.202 zgit "and then upload your own public key to the server ' SCP ~/.ssh/id_rsa.pub [email protected]:/tmp/# login to git server ls/ Tmp/id_rsa.pub #显示已经上传的密钥 ' 5. Generate Git users on the server, use git user and initialize ' gitosis ' # to create git version Admin user gitsudo useradd-c ' git versions manage ' -m-d/home/git-s bin/bash git# change git user's password sudo passwd git# su to git user su-gitgitosis-init </tmp/id_rsa.pub# display the following information as Gong #initialized empty git repository in/home/git/repositories/gitosis-admin.git/#Reinitialized existing git repository in/home/git/repositories/gitosis-admin.git/#删除密钥rm-rf/tmp/id_rsa.pub "6. Export project Management on a personal development machine" ' Mkdir-p/REPOCD/ Repogit Clone [Email protected]:gitosis-admin.git ' 7. Adding and setting management items in the personal development machine "' cd/repo/gitosis-admin# See the GIT server has uploaded the key ls keydir cat keydir/[email protected] #[email protected] The last string for the generated public # Display key for the uploaded dev machine is the key user name Here for [Email protected]vim gitosis.conf# Add the following at the end of the file [group Test-git] # hasWrite permission group name writable = test-git # The group can write the project name members = [email protected] [email protected] #该组的成员 (key username) multiple When a user is co-developing, separate # with a space # if you want to add a read-only group reference to the following # [group Test-git-readnoly] # with the permissions of the group name # readonly = test-git # The group is read-only Project Name # members = [email protected] # Member of the group # commits to modify git Add. Git commit-a-M "Add test-git repo" git push "8. On the personal development machine initial , add and Use Project Test-git "' CD ~/repo mkdir test-git cd test-git git init touch readme git Add. Git commit-a-M "Init test-git" git remote add origin [email protected]:test-git.git git push Origin master ' 9. Add the public key of the co-developer to the GIT server-execute ' CD repo/gitosis-admin/keydir ' switch directory-copy the data from the co-developer's id_rsa.pub file to the corresponding developer's ' key user name. pub ' file. Paste the text of the key user name [email protected] in the id_rsa.pub file into the [email protected] file and save-then update the directory after adding the data to the GIT server ' git add . Git commit-am "add [email protected] file" Git push origin master "This document reference: [CentOS git build reference note], [CentOS Build git server][3] [1]: Http://code.google.com/p/git-core [2]: http://blog.sina.com.cn/s/blog_86fe5b440101975o.html [3]: http://www.cnblogs.com/nasa/archive/2012/05/31/[ email protected]:~/workspace/recipes/doc/linux$
CentOS 6.4 Build a git server