In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "how to build the Git server". In the daily operation, I believe many people have doubts about how to build the Git server. 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 how to build the Git server. Next, please follow the editor to study!
Step 1, install git$ sudo apt-get install git, step 2, create a git user to run the git service $sudo adduser git, step 3, create a certificate login
Collect the public keys of all users who need to log in, which is their own id_rsa.pub file, and import all the public keys into the / home/git/.ssh/authorized_keys file, one line at a time.
Step 4, initialize the Git repository
First select a directory as the Git repository, assuming / srv/sample.git, and enter the command in the / srv directory:
$sudo git init-bare sample.git
Git creates a naked warehouse, which does not have a workspace, because the Git repository on the server is purely for sharing, so users are not allowed to log in directly to the server to change the workspace, and the Git warehouse on the server usually ends with .git. Then, change owner to git:
Step 5 of $sudo chown-R git:git sample.git, disable shell login
For security reasons, the git user created in step 2 is not allowed to log in to shell, which can be done by editing the / etc/passwd file. Find a line similar to the following:
Change git:x:1001:1001:,:/home/git:/bin/bash to: git:x:1001:1001:,:/home/git:/usr/bin/git-shell
In this way, git users can normally use git through ssh, but cannot log in to shell because the git-shell we specified for git users automatically logs out each time they log in.
Step 6, clone the remote warehouse
You can now clone the remote repository with the git clone command and run it on their respective computers:
$git clone git@server:/srv/sample.gitCloning into 'sample'...warning: You appear to have cloned an empty repository.
The rest of the push is simple.
Manage public key
If the team is small, it is possible to collect everyone's public key and put it in the / home/git/.ssh/authorized_keys file on the server. If there are hundreds of people on the team, you can't play like this, and you can use Gitosis to manage the public key.
Here we will not introduce how to play Gitosis, hundreds of people's teams are basically in the top 500s, I believe it is not a problem to find a high-level Linux administrator.
Administrative authority
Many companies that regard not only source code as life, but also employees as thieves, will set up a complete set of permission control in the version control system, and whether everyone has read and write access will be accurate to each branch or even under each directory. Because Git is developed for Linux source code hosting, Git also inherits the spirit of the open source community and does not support permission control. However, because Git supports hook, you can write a series of scripts on the server side to control operations such as commit to achieve the purpose of permission control. Gitolite is this tool.
At this point, the study on "how to build a Git server" 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.