Ubuntu git Server Installation experience

Source: Internet
Author: User

First of all, it should be feasible to install according to the http://www.cnblogs.com/xl19862005/archive/2011/06/28/2092464.html.

However, after adding an existing project to the test, gitosis is messed up. No matter what the result is, the clone fails. So I summarized a common error:

Http://blog.csdn.net/xzongyuan/article/details/9332735

Many questions about the installation process are recorded here.

1. About client and server

Server: gitosis and OpenSSH need to be installed. It is actually a tool for managing/home/git/authories_keys. Refer to the gitosis analysis article to find out what gitosishttp: // geeklu.com/2012/10/gitosis/

Client: you only need to install git and OpenSSH.

2. Does gitosis need to verify the password?

Git authenticates users through SSH. If your gitosis works normally, you do not need to verify the password. However, I have encountered a problem requiring you to enter the password. Therefore, you need two authentication methods for SSH under Baidu. If you need to enter the password, it indicates that your gitosis is not configured successfully. I used gitoisis-init to reinitialize and found that the problem was not solved. Because the content of gitosis. conf has not changed, the file in keydir has not changed, And/home/git/. Ssh/authorized_keys has not changed. So, I will delete all the folders related to gitosis, and then try again gitosis-ini. For details about the files to be deleted, refer to the common error link above.

3. repositories path

We usually initialize it like this: Sudo-H-u git gitosis-init </tmp/id_rsa.pub

This statement is initiated by using/tmp/id_rsa.pub in the home (corresponding to-h) of the user git (corresponding to-U. Why put it in/tmp? Different users on the same computer can log on to/tmp to read and write data. Other paths do not have the read permission or write permission, so it is convenient to operate on/tmp.

After initialization, you will see an additional authorized_keys under/home/git/. Ssh. You can check whether the id_rsa.pub content is read. If an error occurs, you will be asked to enter the password during clone.

After initialization, a folder is generated under/home/git /.

gitosisrepositories

There is also a hidden file

.gitosis.conf

You can run the ll command to check it. It will point to gitosis. conf in the gitosis version repository under repositories.

For convenience, we will not directly focus on gitosis-init, but first do this:

1. Generate the/home/repo directory. The owner is GIT and grant the GIT read/write permission.

2. Then enter the command ln-S/home/repo/home/git/Repositories

Note: Here is a soft link/home/Repo, that is, after you click/home/git/repositories, it will enter/home/repo. The purpose is: if the Link already exists in the path, gitosis will not create or overwrite it, but will directly use it as the version repository. In this way, the actual version repository is/home/repo. In the future, when you clone, this directory will be cloned:

Git clone git @ <your server IP>: XXX. Git. This is the relative path, which is generally correct. If this doesn't work, replace it with GIT clone git @ <your server IP>:/home/repo/xxx. Git. I believe that you will be asked to enter the password when the configuration is incorrect. At this time, you need to reconfigure gitosis.

4. Understand git clone

Git init is often seen. Do you need git for clone?

No. You can clone a folder named mkdir.

5. Understanding gitosis-admin.git

After all, the people who just installed gitosis may be a lot of cainiao, so they will be confused by gitosisi.

Remember the gitosis operation method: operate on the client, not on the server (of course, you can also operate on the server ). It is a version repository and a pure repository without a working directory. Of course, you can find gitosis. conf and keydir on the client, but do not touch the server. Otherwise, if you want to push the client administrator, an error will occur.

So, as long as you want to add a user, add a file permissions, etc., you have to go to the client side, casually find a place to clone the gitosis-admin.git of this warehouse, then modify, and then perform the commit operation:

Git add.

Git commit-am "write your desired custom log information"

Git push origin master

The role of gitosis-Admin is that the administrator can take his notebook everywhere or save the repository without having to format the notebook. The next installed system is good, directly clone the server's gitosis-admin.git can get the latest gitosis, and then modify, then push it on the line, next time you think a change is incorrect, you can also roll back it. Because git management is used, multiple administrators can manage it together and use different branch to modify the server. Once you understand this role, you don't have to question why it is so troublesome.

6. About the permissions of the client and server version Repositories

You do not have to worry about permissions. Do not go to the CHMOD or chown repository file by yourself. After the client submits the changes, the server automatically changes the changed permission and owner to the git of the server.

7. Understand SSH

Do not forget that SSH encryption is used for cloning. Therefore, if you encounter any authentication problems, it is not gitosis. conf is written incorrectly, that is, the ssh-encrypted key pair is out of date and needs to be deleted and re-authenticated.

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.