0. install shgit1.6.6 or a later version. I use CentOS764, yuminstallgit. x86_64, and the Git version is 1.8.xperl5.8.8 or later. CentOS7 comes with release or higher, and CentOS7 comes with Git
0. prerequisites
- Sh
- Git 1.6.6 or later. I use CentOS 7 64-bit, yum install git. x86_64, and Git version 1.8.x
- Perl 5.8.8 or later, CentOS 7 comes with perl 5.16.x
- Openssh 5.0 or later, with CentOS 7
- For a user dedicated to Git, the account name I use is: git
- Private account, it is best not to include ssh settings, that is, it is not found under the $ HOME directory. the ssh folder exists. In addition, it is recommended that the private account be in the sudoers group, so that sudo can be used for root permission work.
In addition, I use Mac, so I need to upload the client's ssh public key to the git server, and according to Gitolite requirements, this public key should be placed under the private account's main directory, instead of merged to ssh. in the ssh/authority_keys file. Because there is no command for ssh-copy-id on Mac, the upload command used is as follows: cat. ssh/id_rsa.pub | ssh [git private account] @ [target server] "umask 077; cat> [git User name]. pub "here we need to replace the corresponding content in square brackets, where the last. pub indicates the file name uploaded to the server. Gitolite requires that you use the git username in the future as the file name. for example, my Git username is michael_li, the last part of the above command is michael_li.pub 1. install Gitolite and switch to the current user's home directory: cd ~ Run the following command to download Gitolite from github and install: git clone git: // github.com/sitaramc/gitolite
Mkdir-p $ HOME/bin
Gitolite/install-to $ HOME/bin will install the gitolite command to the bin folder in the main directory of the account, and automatically add the $ HOME/bin PATH to the current $ PATH through: vim. bash_profile can be seen, so that the gitolite command can be executed under any directory. 2. create the user corresponding to the public key as the administrator of Gitolite: gitolite setup-pk michael_li.pub. here you need to replace it with your own public key file name. refer to the last section in the preparation step. After the command is executed, Gitolite automatically creates the. ssh directory and the authority_keys file, and merges the corresponding administrator's public key file. On the console, you can see that two warnings are prompted for these two steps. If the preceding command is not executed, $ HOME/bin is not under $ PATH. Either use the absolute PATH $ HOME/bin/gitolite, or add the $ PATH and run it again. If you want to add it to $ PATH, use the source command to re-apply the environment variable. 3. Managing Gitolite management is not completed on the server, but after Gitolite is installed, two git libraries will be automatically created on the service, one being Gitolite-admin and test. Therefore, you need to clone the gitolite-admin on the server to the client, that is, the client corresponding to the ssh public key, and execute the command on the client: git clone git @ host: gitolite-admin has two folders in the gitolite-admin Directory of the client, gitolite under conf. conf is used to manage the git Library and the corresponding permissions. the newly added ssh public key file must follow the "user name. put pub in the keydir directory. The ssh public key username must correspond to the username managed in gitolite. conf under conf. Next, like using a common git version library, all the changes under gitolite-admin are committed and pushed to the server. Gitolite on the server automatically creates a new git version library based on the content, and stores it in the repositories folder in the home directory of the server's private account: git add conf
Git add keydir
Git commit-m "added foo repo, gave access to Jason"
Git push till now, Gitolite should be ready for use. The details of Git are still profound and profound. I recommend Jiang Xin's Git authoritative guide, which is very detailed, but too detailed. after reading a lot of content, I know exactly how to do it, and read it with patience. the explanation of the principle is very thorough. According to the command, you can see the effect.