Linux CentOS builds a git server

Source: Internet
Author: User

1. Install git with yum install Git-core (server)

2. Create a bare repository (server)

[Email protected]]$ mkdir/home//home/-bare wwwroot.git

3. Give permissions (server)

Chown-r Git:git Wwwroot.git

4. Add git user and password (server)

AddUser git

passwd git 123

5. Prohibit Shell login If you do not know where git is used:which Git-shell find out the correct path (server)

Edit/etc/passwd

Git:x:1001:1001:,,,:/home/git:/bin/bash

Switch

Git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell

6. Download the GIT project (client) remotely with clone

git clone [email protected]115.28. 38.789:/home/workspacewwwroot.git

IP and path must be completed correctly

7. the client can manipulate git-related operations

git add *

Git commit-m ' add '

git remote add origin [email protected]:/home/workspacewwwroot.git ( used only for the first time, no need to use it for the second time, Direct push is OK )

Git push Origin Master

These commands can be completed each time the item is modified or added

8. Make a git and web directory connection and browse the site synchronously

Set up the hooks so that each time you run Git you can submit a Web browser

[Email protected]]$ cd/home/workspace/wwwroot.git/> Post-receive <<EOF>#!/bin/  Bash>git--work-tree=/home/website/wwwroot Checkout->+x post-receive

Distributed server, each computer can be as a git server, each computer is a node! Good luck, June!

Linux CentOS builds a git server

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.