Redhatcentos install and configure gitgitosisgitweb1git (1) install gityuminstallgit using the yum source (2) create a git User and set the password useradd -- homehomegitgitpasswdgit. Note that you need to set a password here, we recommend that you do not set up git/gitosis/gitweb in redhat/centos. install and configure git (1) use the yum source to install gityum install git (2) create a git User and set the password # useradd -- home/git # passwd git // note that you need to set a password here. do not set a password, many documents on the Internet do not have a password (3) Create a git repository to verify that git is available before using git. set the following two global variables for git: # git config -- global user. name "dylan" # git config- -Global user. email "ustc.dylan@email.com" sets git repository directory permissions # su-git // switch to git User $ chmod-R 755/home/git // modify directory permissions to create and initialize a repository $ mkdir/home/git/repo // assume that the repository to be created is stored in the/home/git/repo directory $ cd/home/git/repo $ mkdir test_repo $ cd test_repo $ git init -- bare test whether the newly created repository can be su-test (test is another user or exit, use root user) $ cd/home/test $ mkdir repos $ cd repos $ git clone/home/git/repo/test_repo if "Initial Ized empty Git repository in/home/git/repo/test_repo/. git/"indicates that a local repository is successfully cloned. Later, you can develop a readme.txt file in this repository. $ Cd test_repo $ vim readme.txt (create a file) $ git add. (note the following [.]) $ git commit-a $ git push origin master Note: If an error is reported at this time, the biggest reason is that the refs and objects directory permissions of test_repo are insufficient, perform the following operations (the two directories under the repository of the git server ). $ Chmod-R 777 refs/$ chmod-R 777 objects/2. gitosis installation (1) python-setuptools installation (because gitosis installation scripts are written in python) # yum install python-setuptools (2) gitosis installation # git clone git: // github.com/res0nat0r/gitosis.git//download gitosisto your desired directory. unzip CD gitosis # python setup. py install // if no error is reported, the installation is successful (3) the user's public key of the git server is created because gitosis access is through ssh, therefore, we also need to create an ssh access public key. Find another machine (if conditions permit) to create a public key as the client machine of the git server, and then upload it to the git server. (For ease of use, you can also create a public key on the git server, using git users or other users. For convenience, the git server is used here and the git User is used. # Su-git $ ssh-keygen-t rsa public key is generated, which is stored in/home/git/by default /. in ssh/id_rsa.pub, if a password is set when the public key is generated, remember the password. for simplicity, I have not set a password here. (4) configure gitosis various git management through the gitosis-admin.git this project to complete, the gitosis-admin.git project itself is put under git management, so you need to first in the client side clone gitosis-admin.git, after modification as needed, submit the modification to the git server to take effect. The meaning here is: where you want to configure gitosis, you need to clone to gitosis-admin.git. assume that the gitosis-admin.git is cloned locally using a git User on another machine different from gitosis. Git clone git@192.168.x.xx:/home/git/repositories/gitosis-admin.git modify gitosis configuration file gitosis. conf $ vim gitosis. conf // you will see the following content [gitosis] [group gitosis-admin] writable = gitosis-adminmembers = the git@compute-29-01.localgitosis.conf file is the control file used to set the user, Repository and permissions (for gitosis. the detailed description of the conf file and the role of the public key under the keydir directory will be described in another document and will not be detailed here). you only need to know that the gitosis repository is writable, supported users: git (5) add a new repository to modify the gitosis-admin configuration file gitosis. conf, add a new repository, for example: [gitosis] [Group gitosis-admin] writable = gitosis-adminmembers = git@compute-29-01.local [group test_repo] // read and write permissions for the newly added repository name writable = test_repo, here members = user1 @ host1 user2 @ host2 // the username @ host name that can access this repository. assume that when user1 accesses this test_repo repository, enter the following command: git clone user1 @ git_server_ip:/home/git/repo/test_repo.git requires the user1 password, which is the password entered when user1 is created. So how does gitosis determine the identity of user1? This requires that the public key generated by user1 be transmitted to the administrator in advance, that is, the administrator who has permission to operate on gitosis-admin, and then copy the public key to the keydir Directory. then, execute git add and git push. 3. gitweb Installation Note: the redhat iso source does not have the gitweb installation package, but the centos source does. in the previous article, we showed how to make redhat use the centos source, you only need to use the following command to install the SDK. # Yum install gitweb4. gitweb configuration gitweb is installed under/var/www/git by default, and its configuration file is in/etc/gitweb. conf. In addition, the httpd configuration file/etc/httpd/conf. d/git. conf. (1) modify/etc/gitweb. conf $ projectroot = "/var/www/git" // change projectroot to/var/www/git (2) and/etc/httpd/conf. d/git. conf Alias/git/var/www/git Allow from allAllowOverride allOrder allow, denyOptions + ExecCGIAddHandler cgi-script. cgiDirectoryIndex gitweb. cgiSetEnv GITWEB_CONFIG/etc/gitweb. confDav OnRewriteEngine Off (3) restart httpd/etc/init. d/httpd restart (4) connect the gitosis repository to/var/www/git, complete the web display ln-s/home/git/repositories/test_repo.git/var/www/git/(5) browse http: // xxxx/git/in the browser. note: if the git update-server-info error occurs when git clone http: // xxx/git/test_repo.git, run the git update-server-info command in the test_repos.git Directory (under the corresponding repository of the gitosis server ). 5. create a new git repository. in the/home/git/repository Directory of the git server, run the following command: mkdir test. gitcd test. gitgit init -- bare // you can add the source file here, or add it after the client clone.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service