Get the App
SLTechnology News&Howtos  ›  Development  › 

How to build git server under Linux

Shulou Source: shulou.com Published: 2022-06-01 22:24:37 09月28日 Update

This article mainly introduces how to build a git server under Linux. It is very detailed and has a certain reference value. Interested friends must finish reading it!

Git is an open source distributed version control system for efficient and high-speed version management of projects ranging from very small to very large.

We will 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 users to run the git service:

$groupadd git$ useradd git-g git2, create certificate login

Collect the public keys of all users who need to log in. The public keys are in the id_rsa.pub file. Import our public keys into the / home/git/.ssh/authorized_keys file, one line at a time.

If you do not have the file to create it:

$cd / home/git/$ mkdir .ssh $chmod 755 .ssh $touch .ssh / authorized_keys$ chmod 644.ssh / authorized_keys3, initialize the Git repository

First, we select a directory as the Git repository, assuming it is / home/gitrepo/runoob.git, and enter the command in the / home/gitrepo directory:

$cd / home$ mkdir gitrepo$ chown git:git gitrepo/$ cd gitrepo$ git init-- bare runoob.gitInitialized empty Git repository in / home/gitrepo/runoob.git/

The above command Git creates an empty repository, and the Git repository on the server usually ends with .git. Then, change the user of the warehouse to git:

$chown-R git:git runoob.git

4. Clone warehouse

$git clone git@192.168.45.4:/home/gitrepo/runoob.gitCloning into 'runoob'...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 modify it to your own Git service ip.

This completes the installation of our Git server.

These are all the contents of the article "how to build a git server under Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Service server warehouse user public key file content command version directory article login valid next line value interest distributed boy buddy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei Shulou Information Apple Redmi MariaDB