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

How to build a Git Server

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article introduces you how to build a Git Server, the content is very detailed, interested friends can refer to, hope to be helpful to you.

Preface

We usually use GitHub, GitLab, Gitee and other services, so how do we build a Git Server? here we build a simple Git Server.

Operation instructions: in this example, the git service is built on a CVM, in which 1, 2, 3, 4, 5 are all operations on the CVM. Of course, you can also operate in a virtual machine or docker. Create the git user adduser\-- system\-- shell / bin/bash\-- gecos' Git Version Control'\-- group\-- disabled-password\-- home/ home/git\ git2. Create the .ssh directory / home# su git/home# cd git/home/git# mkdir .ssh & & chmod 700.ssh / home/git# touch .ssh / authorized_keys & & chmod 600.ssh / authorized_keys3. The root directory of the custom repository / home/git# mkdir code_repository

Note: you need to use git users to operate here.

4. Create a naked warehouse / home/git# cd code_repository//home/git/code_repository# mkdir abc.git/home/git/code_repository# cd abc.git//home/git/code_repository/abc.git# git init-- bare on the server

Note: you need to use git users to operate here.

5. Manually configure a public key

Add our own local public key file to / home/git/.ssh/authorized_keys

6. Test whether you can operate $mkdir abc$ cd abc$ git init$ touch README.md$ git add. $git commit-m "first add reademe.md" $git remote add origin ssh://git@xxx.xx.xx.xx:/home/git/code_repository/abc.git$ git push-u origin master locally.

Note: this is run locally, not on the server

The repository created in this way does not have any permissions, as long as the public key user in authorized_keys can read and write to the repository.

On how to build a Git Server to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Internet Technology

Wechat

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

12
Report