Ubuntu git Server Setup

Source: Internet
Author: User
Tags git clone

1. Installing the Git and SSH tools

Apt-get Install Git-core openssh-server openssh-client

2. Add a user named Git

Useradd-m git

passwd git

3. Create a new git repository directory and modify directory permissions

Mkdir/home/gitprojects

Chown git:git/home/gitprojects

chmod 700/home/gitprojects

4. Installing Gitosis

Apt-get Install Python-setuptools

git clone https://github.com/res0nat0r/gitosis.git

CD gitosis

Python setup.py Install

5. Switch to git user, link/home/gitprojects and/home/git/repositories

Su git

Ln-s/home/gitprojects/home/git/repositories

6. Configure Gitosis

Need to generate Sshkey on the client computer and upload id_rsa.pub to a server directory

ssh-keygen–t RSA

SCP xxx/.ssh/id_rsa.pub [Email protected]:/home/id_rsa.pub

7. Modify the Id_rsa.pub permissions on the server and run Gitosis

chmod a+r/tmp/id_rsa.pub

Sudo–h–u git gitosis-init

8. Modify post-update file permissions

sudo chmod 755/home/gitprojects/gitosis-admin.git/hooks/post-update

9. Create a new warehouse on the server lsgame.git

Su git

Cd/home/gitprojects

Git init--bare lsgame.git

10. Configure Gitosis

back to client clone Gitosis-admin.git

git clone [email protected]10.203.148.102: Gitosis-admin.git

Gitosis the Sshkey of the other hosts into the Keydir and configure the gitosis.conf files as needed

Example

[Gitosis]

[Group Gitosis-admin]

Members = [email protected]

writable = Gitosis-admin

[Group Lsgame]

Members = [email protected]

writable = Lsgame

Commit modification Configuration

git Add.

Git commit-am "xx"

Git push Origin Master

11. Client-Submitted code

Git init

git Add.

Git commit-am "initial version"

git remote add origin [email protected]<server>:lsgame.git

Git push Origin Master

Ubuntu git Server Setup

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.