Build a git server

Source: Internet
Author: User
Tags openssh server

1. Install OpenSSH server

sudo apt-get install openssh-server openssh-client

2. Create a personal public key and private key

Under the default user's home directory path, run the following command to follow the prompts to create the public and private keys

SSH-KEYGEN-T RSA

Generate 2048-bit by default, or you can create a public and private key by using the following command if you need to increase the security level

Ssh-keygen-t rsa-b 4096

By default, the public and private keys are saved in the ~/.ssh directory, as follows:

Id_rsa  id_rsa.pub  known_hosts

3. Install the GIT server

sudo apt-get install Git-core

4. Configure the GIT server

Create a GIT server administrative user

sudo useradd-m gitsudo passwd git

Create a git repository storage directory

sudo mkdir/home/git/repositories

Set git repository permissions

sudo chown git:git/home/git/repositoriessudo chmod 755/home/git/repositories

Initialize Global Settings

git config--global user.name "myname" git config--global user.email "[Email protected]"

5. Install Python Setup Tool

sudo apt-get install Python-setuptools

6. Get and install Gitosis

Cd/tmpgit clone Https://github.com/res0nat0r/gitosis.gitcd Gitosissudo python setup.py install

7, Configuration Gitosis

CP ~/.ssh/id_rsa.pub/tmpsudo-h-u git gitosis-init </tmp/id_rsa.pubsudo chmod 755/home/git/repositories/gitosis-ad Min.git/hooks/post-update

8, Management gitosis configuration

CD ~git clone [email protected]: User name/gitosis-admin.gitcd gitosis-admin/
Here to note, how to still be from native clone to native then need to hit Git clone/path/gitosis-admin.git/

Build a git server

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.