Install Git and Gitolite in Ubuntu

Source: Internet
Author: User
Tags ssh server
Install Git and gitolite‑tuserver11.04git in Ubuntu. the gcc tool is not installed in the server version system by default, and additional installation is required. the desktop can be installed through sudoapt-get after the machine can connect to the Internet (note: first... install the source code package of Git and Gitolite Ubuntu Server 11.04git in Ubuntu. the gcc tool is not installed in the server version system by default, and additional installation is required. the desktop can be installed through sudo apt-get after the machine can connect to the Internet. (note: update the package source list first,
Sudo apt-get update. otherwise, apt-get will only find the corresponding package from the local device. it is certainly not found.) 2. decompress the gitsource code package. We use git-1.7.4.2.tar.bz2 www.2cto.com 3. git dependent package Depends: libc6 (> = 2.7), libcurl3-gnutls (> = 7.16.2-1), libexpat1 (> = 1.95.8), zlib1g (> =. 2.0), perl-modules, liberror-perl, git-man (>. 7.4.1), git-man (<1:1. 7.4.1 -.), emacsen-common3. the permission to modify the source code directory is generally 7554. cd, such as the source code directory ,. /configure5. make6. make install apt-get install sudo apt-get install git or To access sudo apt-get install git-core git-doc SSH, you need to install openssh-server on the server and start its service 1. create a git User for server management sudo adduser -- system -- shell/bin/bash -- group git sudo passwd git change git password www.2cto.com 2. su git enters git User-generated ssh key3 client-generated ssh key ssh-keygen4. upload the ssh public key generated by the client to the server, and then run cat/path/to/user1.pub> ~ Anonymous/. ssh/authorized_keys
Add your public key to the authentication so that you can log on to the server by using the ssh Server user name @ server Ip or machine name, such as the ssh git@192.168.32.92
If you are prompted to enter the password, it means ssh is not successful (note: This step does not need to be automatically added in gl-setup) gitolite installation configuration 1. clone the source code of gitolite from github git clone git: // github.com/ossxp-com/gitolite2. go to the src Directory of the source code and note that the original. /gl-easy-install installation method has been. /gl-system-install will generate the bin and share directories under the root directory of the current user. the steps in bin are basically the same as those in the source code. 3. add the environment variable PATH =/home/git/bin: $ PATH4. copy the ssh public key of the client to the/home/git directory and add it as the gitolite administrator account gl-setup/path/to/user1.pub. generate the repositories directory and projects. l The list file repositories directory contains the gitolite-admin.git and testing. git gitolite-admin.git is the administrator's library, the administrator clone it to add users, configure permissions and then push them to the server. if you want to modify the default gitolite library path, you need to modify the/home/git directory. gitolite. rc file 5. the client clones the gitolite-admin library to manage users and permissions. Copy the user's key to the keydir directory and add, commit, and push the user to complete permission control in conf/gitolite. in the conf file, for specific permission configuration rules, see the gitolite document. after the permissions are modified, add, commit, and push are required. if you want to modify the repositories directory name or path, it must be modified when gitolite is installed. after installation, it cannot be modified. Define the alias of the ssh connection server in. create a config file in the ssh Directory. the content format is as follows: host alias www.2cto.com user server username hostname server name or ip IdentityFile local key file instance host gitDemo user git hostname 192.168.32.92 IdentityFile ~ /. Ssh/id_rsa can use git clone gitDemo: gitolite-admin to replace git clone git@192.168.32.92: gitolite-admin with the permission to remotely create a configuration Library gitolite. add the following configuration repo demo/to the conf file /. + C = @ admin RW = @ admin push, you can use git to push gitDemo: demo/demo1.git master in the remote git User directory.
Create a demo directory under the repositories directory and demo1.git library to install and configure gitweb1. sudo apt-get install gitweb2. sudo apt-get install apache23. mkdir/home/ /Gitweb4. sudo ln-sf/usr/share/gitweb/*/home/ /Gitweb5. ln-s /Home/ /Gitweb6. sudo vi/etc/gitweb. conf $ projectroot = "/home/ /Gitweb "; 7. sudo vi/etc/apache2/conf. d/gitweb Www.2cto.com ServerName gitDemoScriptAlias/gitweb/usr/lib/cgi-bin/DirectoryIndex/gitweb. cgiDocumentRoot/home/clean/gitwebErrorLog/var/log/apache2/git.pcware.cn-error. logCustomlog "/var/log/apache2/git.pcware.cn-error. log "combined 8. sudo/etc/init. d/apache2 restart9. chmod-R 755 10. http: // 127.0.0.1. you can modify the text description of git repo by modifying $ {GIT_DIR}/description. Gitweb configuration does not require virtual machines. install gitweb apt-get install gitweb 2. uninstall apt-get remove gitweb 3. install apache2 server apt-get install apache2 4. after successful installation, you will find that the gitweb configuration file is in/usr/share/gitweb, and the cgi file is stored in/usr/lib/cgi-bin. create the home/usrname/gitweb directory and store the git inventory in this directory or connect the git library to this command:
Ln-sf git repository address gitweb path here is (/home/usrname/gitweb), in order to be able to update gitweb's
You need to modify the post-update in the git library so that anyone can execute the command as follows: chmod 755 /. git/hooks/post-update 6. link the gitweb configuration file to the gitweb Directory command: ln-sf/usr/share/gitweb/home/usrname/gitweb www.2cto.com 7. set gitweb. copy cgi to/home/usrname/gitweb 8. modify apache settings and edit/etc/apache2/httpd. add the following content to the conf file: ServerName127.0.0.1: 80 9. modify gitweb. conf (/ect/apache2/conf. d/gitweb. conf) add the following content: Alias/gitweb/home/usrname/gitweb Options + Indexes + ExecCGI + FollowSymLinks AllowOverride All order allow, deny allow from all AddHandler cgi-script cgi DirectoryIndex gitweb. cgi 10. restart the apache2 service after the configuration is complete. Command: sudo/etc/init. d/apache2 restart11. enter the local IP address/gitweb in the browser to access the git Service. for example, http: // 192.168.110.120/gitweb www.2cto.com. note: when cloning a repository from gitolite, the relative path is used. for example, in/home/git/demo/demo1.git, you only need to use git to clone gitDemo: demo1.git ssh key. you can change the permission of the ssh directory to 700 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: unprotected private key file! @ Permissions 0744 for '/home/git /. ssh/id_rsa 'are too open. author: Lanqiao scholar
Related Article

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.