Linux Build git service (server)

Source: Internet
Author: User

We need to install git before we start using Git. Git currently supports running on Linux/unix, Solaris, Mac, and Windows platforms.

The Git platform installation package is: Http://git-scm.com/downloads

First, install Git

Git's work calls for code from libraries such as CURL,ZLIB,OPENSSL,EXPAT,LIBICONV, so you need to install these dependent tools first.

My linux is the CentOS kernel, so you can use the Yum command to install:

$ yum Install curl-devel expat-devel gettext-devel openssl-devel zlib-devel$ yum-y install git-core$ git--versiongit ver Sion 1.71

Second, configure Git

1. Add git user groups and Git users

$ groupadd git$ useradd git-g git-m-s/bin/bash$ passwd git #设置密码 $ vim/etc/sudoers #加上下面一句 git all= (all:all) all, put Git Added to the sudoers user. $ su git #切换到git用户下工作

2. Create a blank warehouse

$ cd ~$ mkdir project.git$ cd project.git$ git init--bare # Create a naked warehouse, why add bare can own Baidu initialized empty git repository in/h ome/git/project.git/

3. Add several user accounts

$ cd ~$ sudo useraddd satan-g git-m-s/bin/bash$ sudo usermod-g git,root Satan #把satan用户同时添加到root和git组 $ sudo passwd sa Tan #设置密码

4. Configure the private key for user Satan

$ mkdir/home/git/.ssh$ Vim/home/git/.ssh/authorized_keys #将用户satan的公钥添加到此文件中, if not created

5. Modify git config

$ vim/home/git/project.git/config #添加如下两行 [receive]        Denycurrentbranch = Ignore

6. Restart SSH

$ sudo/etc/init.d/sshd Restart #重启ssh

Third, END

The GIT server configuration is basically complete, leaving only the client to configure the GIT environment, generate the corresponding user's public key, the public key will be added to the Git directory in the Authorized_keys file, can be used.

Linux Build git service (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.