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