Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Steps to build a Git service

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces "the steps of building Git services". In the daily operation, I believe that many people have doubts about the steps of building Git services. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about the steps of building Git services. Next, please follow the editor to study!

1. Install dependent libraries and compilation tools

# yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel-y

# yum install gcc perl-ExtUtils-MakeMaker-y

two。 Select a directory to put the downloaded installation package. Here, put the installation package in the / usr/local/src directory, go to the official website and find a new and stable source package to download to the / usr/local/src folder.

Official website

Https://git-scm.com/book/zh/v1

Https://mirrors.edge.kernel.org/pub/software/scm/git/

# wget https://www.kernel.org/pub/software/scm/git/git-2.10.0.tar.gz

Decompression

# tar-zvxf git-2.10.0.tar.gz

# cd git-2.10.0

# make all prefix=/usr/local/git

# make install prefix=/usr/local/git

3. Configure environment variables

Change the original PATH pointing directory to the current directory

# echo 'export PATH=$PATH:/usr/local/git/bin' > > / etc/bashrc

Effective environment variable

# source / etc/bashrc

At this point we can check the git version number, which means that we have successfully installed it.

# git-version

4. Create git account password

Create a git account

# useradd-m gituser

Then set the password for this account

# passwd gituser

5. Initialize the git repository and configure user permissions

Create a git repository and initialize it

We create the / data/repositories directory to store the git repository

# mkdir-p / data/repositories

Once created, initialize the warehouse

# cd / data/repositories/ & & git init-- bare test.git

Configure user permissions

Set users and user groups and set permissions to the git repository directory

# chown-R gituser:gituser / data/repositories

# chmod 755 / data/repositories

Find the directory where git-shell is located

, edit the / etc/passwd file, and change the login shell configuration of the last line about gituser to the directory of git-shell

As follows

# vi / etc/passwd

# gituser:x:500:500::/home/gituser:/usr/local/git/bin/git-shell

6. Use the built Git service

Clone test repo locally

Cd & & git clone gituser@123.207.27.137:/data/repositories/test.git

The Git server has been built, and from then on you can easily submit your local code to the Git server for hosting

At this point, the study of "steps for building Git services" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report