Gitolite+gitweb Configuration implementation git Rights Management tutorial

Source: Internet
Author: User
Tags chmod ssh git clone


The server that is used in the article, refers to the public network IP on the servers side.
/mnt is my Aliyun plug-in, the new user does not specify a target location, automatically generated under/home.

Gitolite Configuration

1, set up a git user under the specified directory/mnt/git and set the password for Git to the user. (Server side-User: root)

useradd-d/mnt/git-s/bin/bash git
passwd git
Testing is successful, if successful through SSH connection proves that the user has been established successfully.

SSH Git@server
2. Clone Gitolite (server side-User: git)

Switch to git user
Su git
Switch to git root directory
Cd
Clone Gitolite
git clone https://github.com/sitaramc/gitolite.git
Success will see a gitolites directory in the root directory.

3. Client-generated secret key (client)

Ssh-keygen
will be found in the directory of the users you log in to. SSH directory, my directory is C:\Users\new\.ssh, copy id_rsa.pub to D-Packing directory.

Upload id_rsa.pub via ssh and rename to Admin.pub.

Switch to D disk directory execution
SCP Id_rsa.pub git@server:admin.pub
Once the execution is complete, switch to the server side to find the admin.pub in the root directory of the Git user

4, start installation Gitolite (server-User: git), all operations are in the root directory of Git.
Note the point:
Enter. SSH directory, if there is Authorized_keys, delete it.

New Bin directory
MkDir bin

Install Gitolite, the default will be installed to the bin, if you want to install to your own designated directory please refer to the official installation-to
Gitolite/install-ln

Configure Secret Keys
Bin/gitolite SETUP-PK admin.pub

Whether the test executed successfully

First, does the git root directory generate projects.list and repositories
At the same time, you can enter. SSH, you can see the newly generated Authorized_keys, every time you submit new users will write to this inside. To determine whether the user added success, see if the file is added to the user key can be.

5. Client Clone gitolite-admin (client)

The end does not need to add. git
git clone git@server:gitolite-admin

6. Add new User (client)

Modify Gitolite-admin/conf/gitolite.conf

@developer = weiwei1628 mac

Repo Gitolite-admin

rw+ = weiwei1628 mac

Repo Testing

rw+ = @all

Repo Anhei
rw+ = @developer
Put the new user's key into the Keydir

Push to the server, see if the success, go to the server into Git user, view. Ssh/authorized_keys, there will be more new key.

Gitweb Configuration

1. Installation (server side-User: root)

Yum Install Gitweb

2. Configuration (server side-User: root)

/etc/gitweb.conf

$projectroot = "/home/git/repositories/";

3. Restart httpd (server side-User: root)

Service httpd Restart
You can see the Gitweb Web site, but there will be 404 of items that cannot be found.
This issue is a matter of authority, not a lot of information, and also encountered a lot of pits.

The Final Solution:

First, modify the umask in the/home/git/.gitolite.rc and change the 0007 to 0027.

modifying git and its root directory read-write permissions are 755.

Switch to root, execute in root root directory
Chmod-r 755/mnt/git
There are configuration methods on the Web, but Gitweb is finding the project. But the client has no clone files. Prompt secret key does not have permission

chmod g+r/mnt/git/projects.list
Chmod-r g+rx/mnt/git/repositories

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.