Git server setup
In the previous chapter, our remote warehouse used Github. Github
Public projects are free, but if you don't want others to see your project you will need to pay.
At this time we need to build a Git server ourselves as a private warehouse.
Next we will use
Take Centos as an example to build a Git server.
1. Install Git
$ yum install curl-devel expat-devel
gettext-devel openssl-devel zlib-devel perl-devel
$ yum install
git
Next we create a git user group and user to run the git service:
$ groupadd git
$ adduser git -g
git
2. Create certificate login
Collect the public keys of all users who need to log in. The public keys are located in the id_rsa.pub file. Import our public keys into the /home/git/.ssh/authorized_keys file. A row.
Create it if there is no such file:
$ cd /home/git/ $ mkdir .ssh $ chmod 700 .ssh $ touch .ssh/authorized_keys $ chmod 600 .ssh/authorized_keys
3. Initialize the Git repository
First we select a directory as the Git repository, assuming it is /home/gitrepo/w3cschoolcc.git, in /home Enter the command in the /gitrepo directory:
$ cd /home $ mkdir gitrepo $ chown git:git gitrepo/ $ cd gitrepo $ git init --bare w3cschoolcc.git Initialized empty Git repository in /home/gitrepo/w3cschoolcc.git/
The above command Git creates an empty warehouse. Git warehouses on the server usually end with .git. Then, change the user of the warehouse to git:
$ chown -R git:git
w3cschoolcc.git
4. Clone the warehouse
$ git clone git@192.168.45.4:/home/gitrepo/w3cschoolcc.git Cloning into 'w3cschoolcc'... warning: You appear to have cloned an empty repository. Checking connectivity... done.
192.168.45.4 is the server IP where Git is located. You need to change it to your own Git service IP.
In this way, our Git server installation is complete, and then we can disable git
User login through shell can be completed by editing the /etc/passwd file. Find a line similar to the following:
git:x:503:503::/home/git:/bin/bash
Change to:
git:x:503:503::/home/git: /sbin/nologin
The above is the detailed explanation of the server setup of the Git tutorial. For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 English version
Recommended: Win version, supports code prompts!

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 Chinese version
Chinese version, very easy to use

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function
