Cenos Build a git server
Assuming you already have sudo access to the user account, below, formally start the installation.
First step, install git :
# yum Install git
The second step is to create a git user to run the git service:
# AddUser git
The third step is to create a certificate login:
Git client production into id_rsa.pub, input command
SSH-KEYGEN-T RSA
Id_rsa.pub this file in the C:\Users\Administrator\.ssh directory on the Windows host
id_rsa.pub file, import all public keys into /home/git/.ssh/authorized_keys file, one line at a. You can use cat id_rsa.pub >> authorized_keys
If Authorized_keys does not exist on the server then touch authorized_keys to create it
The fourth step is to initialize the GIT repository:
Select a directory to use as a git repository and do so in the/home/git directory. I'm working under other directories, but there's always a permissions problem, so it's not wrong to create a warehouse in the/home/git directory.
# git init--bare sample.git
.git ends. Then, change owner to git :
# chown-r Git:git Sample.git
Fifth step, disable the shell login:
For security reasons, the GIT user created in the second step is not allowed to log in to the shell, which can be done by editing the /etc/passwd file. Find a line similar to the following:
git:x:1001:1001:,,,:/home/git:/bin/bash
Switch
git:x:1001:1001:,,,:/home/git:/usr/bin/git-shell
git users can use git normally via SSH, but cannot log in to the shell because we are git User-specified git-shell automatically exits every time you log on.
Sixth step, clone the remote repository:
Now, you can git clone clone the remote repository by command and run it on your own computer:
$ git clone [email protected]:/srv/sample.gitcloning into ' sample ' ... warning:you appear to having cloned an empty repositor Y.
The rest of the push is simple.
Deploy the code uploaded to the git server to a truly accessible Web server.
Using commands
Git Clone/home/git/ios.git/var/www/html/api
This will get the code on the GIT server under/var/www/html/api, which is the code you uploaded from the developer's local repository, each time after GIT push Origin master, to the server/var/www/html/api Directory execution git pull pulls the code down is the latest code.
And so on the automatic deployment and then to update the blog
Linux build git server