Install git and gitolite servers on CentOS 6.4x64

Source: Internet
Author: User

Install git and gitolite servers on CentOS 6.4x64

I. Deployment Environment

System: CentOS 6.4x64 minimal installation

IP: 192.168.3.27

Ii. Install the basic dependency package

[root@nginx~] #yuminstallcurl-develexpat-develgettext-developenssl-develzlib-develperl-devel-y

3. Download git-2.2.0.tar.gz

[root@nginx~] #wgethttps://www.kernel.org/pub/software/scm/git/git-2.2.0.tar.gz

4. decompress the file to the current directory and install

[root@nginxgit-2.2.0] #tarxfgit-2.2.0.tar.gz [root@nginxgit-2.2.0] #cdgit-2.2.0/ [root@nginxgit-2.2.0] #makeprefix=/usr/local/gitall [root@nginxgit-2.2.0] #makeprefix=/usr/local/gitinstall Add soft connection [root@nginxgit-2.2.0] #ln-s/usr/local/git/bin/*/usr/bin/ Verification result. The published document number is displayed, indicating that the installation is successful. [root@nginxgit-2.2.0] #git--version gitversion2.2.0

5. Create a git user

[root@nginx~] #addusergit

6. Install gitolite In the git user's home directory

[root@nginx~] #sugit [git@nginxroot]$ cd [git@nginx~]$ mkdir bin

7. Clone gitolite source code

[git@nginx~]$gitclonehttps: //github .com /sitaramc/gitolite .git Cloninginto 'gitolite' ...remote:Countingobjects:8884, done . remote:Total8884(delta0),reused0(delta0),pack-reused8884Receiving objects:100%(8884 /8884 ),3.66MiB|179.00KiB /s , done . Resolvingdeltas:100%(5055 /5055 ), done .Checkingconnectivity... done . [git@nginx~]$ ls bingitolite

8. Install gitolite

[git@nginx~]$. /gitolite/install --to /home/git/bin/ [git@nginx~]$ ls bin/ commandsgitolitegitolite-shelllibsyntactic-sugartriggersVERSIONVREF

9. Configure the gitolite Administrator

Generate the public key of the Administrator account (specify the local root user as the administrator here, and press enter to use the default value)

[root@nginx~] #ssh-keygen [root@nginx~] #cp.ssh/id_rsa.pub/tmp/admin.pub Switch back to the git user and configure the Administrator for gitolite [git@nginx~]$bin /gitolite setup-pk /tmp/admin .pub InitializedemptyGitrepository in /home/git/repositories/gitolite-admin .git /Initialized emptyGitrepository in /home/git/repositories/testing .git/ WARNING: /home/git/ . ssh missing;creatinganewone (thisisnormalonabrandnew install ) WARNING: /home/git/ . ssh /authorized_keys missing;creatinganewone (thisisnormalonabrandnew install ) [git@nginx~]$ ls bingitoliteprojects.listrepositories

10. Daily administrator management

[root@nginx~] #gitclonegit@192.168.3.27:gitolite-admin Cloninginto 'gitolite-admin' ...Theauthenticityofhost '192.168.3.27(192.168.3.27)' can'tbeestablished. RSAkeyfingerprintisc4:34:02:55:ad:42:8a:65:ba:94:00:20:48:d7:3c:33. Areyousureyouwantto continue connecting( yes /no )? yes # This is the first connection. You need to enter yes for confirmation. Warning:Permanentlyadded '192.168.3.27' (RSA)tothelistofknownhosts. remote:Countingobjects:6, done . remote:Compressingobjects:100%(4 /4 ), done . Receivingobjects:100%(6 /6 ),734bytes|0bytes /s , done . remote:Total6(delta0),reused0(delta0) Checkingconnectivity... done . [root@nginxgitolite-admin] #ls confkeydir [root@nginxgitolite-admin] #pwd /root/gitolite-admin

Verification:

Create databases and add users

For example, a test user accesses the mytest database on the git server.

The test user submits his own ssh password-less public key to the git server for Management (this is the local root user of the previous server ).

The Administrator copies the public key of test to gitolite-admin/keydir /.

Note: The key must be generated using ssh-keygen on the test user machine and then transmitted to the 192.168.3.27/tmp directory.

[root@nginx~] #cp/tmp/test.pub/root/gitolite-admin/keydir/

The Administrator creates the myFirstRepo library and assigns permissions to test.

[root@nginx~] #cdgitolite-admin/conf/ [root@nginxconf] #vimgitolite.conf # The following is the default gitolite. conf content. repogitolite-admin RW+=admin repotesting RW+=@all The mytest library is defined below and user permissions are specified: # Add the following content to gitolite. conf: @mygroup= test repomytest RW+=@mygroup Note: @ mygroup is a group, which grants read, write, and push permissions to the database mytest to the mygroup group. (For details, refer to readme.txt of gitolite.) the Administrator will modify gitolite-admin (Create a database and add a user) Submit to git Server [root@nginxgitolite-admin] #pwd /root/gitolite-admin [root@nginxgitolite-admin] # Gitstatus # view the git database status Onbranchmaster Yourbranchisup-to- date with 'origin/master' . Changesnotstaged for commit: (use "gitadd<file>..." toupdatewhatwillbecommitted) (use "gitcheckout--<file>..." todiscardchanges in workingdirectory) modified:conf /gitolite .conf # Indicates the file has been modified. Untrackedfiles:(use "gitadd<file>..." toinclude in whatwillbecommitted) keydir /test .pub # Added files nochangesaddedtocommit(use "gitadd" and /or "gitcommit-a" ) # Add modified files to the git Repository [root@nginxgitolite-admin] #gitaddkeydir/test.pubconf/gitolite.conf [root@nginxgitolite-admin] #gitstatus Onbranchmaster Yourbranchisup-to- date with 'origin/master' . Changestobecommitted:(use "gitresetHEAD<file>..." tounstage) modified:conf /gitolite .conf new file :keydir /test .pub # This indicates that it has been added # The following prompt is displayed when the first gitcommit command is executed. The user must indicate his identity. [root@nginxgitolite-admin] #gitcommit-m"addrepomytest;addusertest" ***Pleasetellme who youare.Run gitconfig--globaluser.email "you@example.com" gitconfig--globaluser.name "YourName" to set youraccount'sdefaultidentity. Omit--globalto set theidentityonly in thisrepository. fatal:unabletoauto-detectemailaddress(got 'root@nginx.(none)' ) # Here we execute the following two Commands [root@nginxgitolite-admin] #gitconfig--globaluser.email"lyao@aaa.com" [root@nginxgitolite-admin] #gitconfig--globaluser.name"lyao" # Re-execute the gitcommit command [root@nginxgitolite-admin] #gitcommit-m"addrepomytest;addusertest" [master7b877e7]addrepomytest; adduser test 2fileschanged,5insertions(+) createmode100644keydir /test .pub # After executing the preceding command, the modified file is submitted locally and not to gitserver. You also need to execute the gitpush command. [root@nginxgitolite-admin] # Gitpushoriginmaster # push to the remote master Branch Countingobjects:6, done .Compressingobjects:100%(5 /5 ), done . Writingobjects:100%(6 /6 ),817bytes|0bytes /s , done . Total6(delta0),reused0(delta0) remote:InitializedemptyGitrepository in /home/git/repositories/mytest .git /To git@192.168.3.27:gitolite-admin 3554f3d..7b877e7master->master

Client Verification:

[root@ipython~] #gitclonegit@192.168.3.27:/mytest.git InitializedemptyGitrepository in /root/mytest/ .git/ warning:Youappeartohaveclonedanemptyrepository. [root@ipython~] #ll total3240drwxr-xr-x3rootroot4096Apr1714:45mytest [root@ipython~] #cdmytest/ [root@ipythonmytest] #gitstatus #Onbranchmaster# #Initialcommit #nothingtocommit(create/copyfilesanduse"gitadd"totrack) Create 1 file 1.txt and add it to git [root@ipythonmytest] #touch1.txt [root@ipythonmytest] #gitadd1.txt [root@ipythonmytest] #gitcommit"addfile1.txt" # ID required for the first use [root@ipythonmytest] #gitcommit-m"addfile1.txt" [master(root-commit)08e9a37]add file 1.txt Committer:root<root@ipython.(none)> Yournameandemailaddresswereconfiguredautomaticallybased onyourusernameand hostname .Pleasecheckthattheyareaccurate. Youcansuppressthismessagebysettingthemexplicitly: gitconfig--globaluser.name "YourName" gitconfig--globaluser.emailyou@example.com Iftheidentityused for thiscommitiswrong,youcanfixitwith: gitcommit--amend--author= 'YourName<you@example.com>' 0fileschanged,0insertions(+),0deletions(-) createmode1006441.txt [root@ipythonmytest] #gitconfig--globaluser.emailtest@aaa.com [root@ipythonmytest] #gitconfig--globaluser.nametest [root@ipythonmytest] #gitcommit-m"addfile1.txt" #Onbranchmasternothingtocommit(workingdirectoryclean) [root@ipythonmytest] #gitstatus #Onbranchmasternothingtocommit(workingdirectoryclean) [root@ipythonmytest] #ll total0-rw-r--r--1rootroot0Apr1714:471.txt [root@ipythonmytest] #gitpushoriginmaster Countingobjects:3, done .Writingobjects:100%(3 /3 ),206bytes, done . Total3(delta0),reused0(delta0)Togit@192.168.3.27: /mytest .git *[newbranch]master->master

This article is from the "ly12743 O & M" blog, please be sure to keep this source http://ly36843.blog.51cto.com/3120113/1633884

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.