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 > Network Security >
Share
Shulou(Shulou.com)05/31 Report--
This article will explain in detail how to use Gitolite to control the repository of Git. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
In fact, Gitolite is also a git repository. First, after installing it on server, download the repository clone on server on client, make some changes locally, and then push back to server. The hooks on server will update the permissions according to the configuration on server.
Next, introduce the installation and configuration steps
Preparatory work
If you used your git account for permission control, remember to change the shell of the git user in / etc/passwd back to / bin/bash, and then remove the key that is no longer needed in ~ git/.ssh/authorized_key.
Use ssh-kengen to generate a pair of key, such as your-name and your-name.pub (as an example below)
Copy the private key to this user's .ssh folder
Mv your-name / .ssh/
Copy the public key to git server
Scp you-name.pub git@your.server.name.or.ip.address:~
For future convenience, you can make a server alias here to specify the user name required for the connection, the address, port and private key of the server
Vim / .ssh/config
Enter the following
Host githostuser your-namehostname your.server.name.or.ip.addressport 22identityfile ~ / .ssh/your-name install Gitolite
Log in to git server
Ssh git@your.server.name.or.ip.address
Download the latest Gitolite
Git clone git://github.com/sitaramc/gitolite
Installation, described here, there are three installation methods, different from specifying the path to generate the gitolite executable file. Here, the second method recommended by the Gitolite author is to generate the file into $HOME/bin, so that you can directly execute the gitolite command in the next bash without specifying the path (if your ~ / bin directory does not exist, remember to mkdir ~ / bin first)
Gitolite/install-ln
Set, since this is the first time to run this command, the key specified here has Gitolite administrator privileges
Gitolite setup-competitive your-name.pub
This command will generate two repository:gitolite-admin.git and testing.git in your ~ / repositories/ directory
Configure permissions
Go back to your workstation.
Exit
The gitolite-admin.git just generated by clone
Git clone githost:gitolite-admin
Note that you are connecting with the server alias you just prepared, and the most important difference is that you use your-name.pub as a key, and instead of using an absolute path to specify the repository that you want to clone, you use the name directly, and the name does not include the suffix .git. This is important because it uses Gitolite's mechanism to clone, and if you skip it and use git directly, then some of its functions cannot be achieved. In the future, clone, push and other repository that need to be controlled by Gitolite permissions must do this.
After clone, there will be a new directory gitolite-admin with two folders, conf and keydir. The first directory contains the configuration file, which is where the permission configuration is recorded, and the second directory contains the pub key of all users.
Now let's open the configuration file and set it according to our permission configuration needs.
Vim gitolite-admin/conf/gitolite.conf
The configuration I expect is as follows, and you can also make changes according to your needs.
@ repos_a @ proj1 @ proj2@repos_b @ proj3 @ proj4 @ proj5@team_a @ user1 @ user2@team_b @ user4repo gitolite-adminRW+ = your-namerepo @ repos_aRW+ = @ team_aR = @ allrepo @ repos_bRW+ = @ team_b
This configuration is very simple. The advantage of defining two repository group and then two user group,group is that when you add repository and user later, you don't need to configure them separately, you just need to add them to the corresponding group.
Add a new repository, configure the corresponding name and permissions in the gitolite.conf file mentioned above, and then push to server. Server will automatically create a bare repository for empty.
If you already have a repository and want to add it, copy it to the ~ / repositories folder on git server, remember that the folder name ends with .git, and the repository must be bare (you can get bare repository by copying the .git folder in repository and running git config-- bool core.bare true, or running git clone-- bare your-repository). An additional operation in this way is to run gitolite setup once on server.
Remove repository, remove the corresponding repo in the configuration file, then push, and then delete the corresponding folder on server.
Add user and copy the pub key to the keydir folder
Delete user. Similarly, remove the corresponding pub key in keydir.
Note that all the operations mentioned above must be changed in the gitolite-admin of clone, and then push, do not do it yourself on server, that is useless, because these permissions configuration, repository management have some additional operations, gitolite-admin will help you take care of everything.
Push your changes back to server and try clone,pull,push to see if the permissions are correct. such as
Git clone githost:proj3 on "how to use Gitolite to achieve access control of Git repository" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, please share it out 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.
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.