Build git Services

Source: Internet
Author: User
1. Notes

Baidu, Google search "build git service", there will be a lot of documents, most of them are not clear, may be copied, pasted or reproduced the process of negligence, but the basic steps are still there, if the patient research attempt or can complete the construction management.

This article is the author through a query on the Internet documents, a number of words, together with their own groping after the introduction of an attempt, only for everyone to reference, if there are errors in the wrong place also please criticize, now thank you here.

The operating environment for this document is as follows:

CPU model Intel (R) Xeon (r) CPU E5620 @ 2.40GHz
Operating system Ubuntu 10.04.4 LTS
Gcc GCC (gcc) 4.1.3 20080704

Before you follow up, please confirm that the system is installed with the following dependencies (this is generally the system, if unfortunately not, you can install the: apt-get)

1) SSH Service

2 Python, Perl

3) Python-setuptools (required when installing with sudo Python setup.py install)

In fact, the above installation if not, the installation of Git with Apt-get will automatically rely on installation. 2. Install git

Installing software on a Linux system is a few routines that are much more complicated than double-clicking in Windows and then always next. In general there are two ways, one is through the Apt-get (limited to Ubuntu, Debian and other systems), command: Sudo apt-get install Git-core. The second is to get git source code, installed through the source code:./configure&&make&&make install. These two have nothing to say, recommend the use of Apt-get way, this will rely on the package all installed, the requirement is to be able to access the Internet or there is an intranet source.

It is worth noting that, to ensure that it is foolproof, you should update the APT source and installation package before installing GIT:

sudo apt-get update

Sudo Apt-get Upgrade 3. Rights Management

Installing Git is basically a way to facilitate the development of multiple people assistance, so permissions management is unavoidable. GIT installation process is simpler, a few commands are basically done, but difficult in the rights management.

After trying two kinds of git's rights Management way Gitosis and gitolite, this article finally selected Gitolite. The reason is very simple, gitosis is the first attempt, after countless times to modify the configuration, file properties, and so on, the error still, n times after the problem is still, but fortunately, Google, although not solve the problem, but let me gitosis despair, Because I saw the following words:
"I would use Gitolite instead. Gitosis is no longer actively developed. "
Prompted me to finally choose the Gitolite, also very recommended to use this.

Gitolite use of more people, installation configuration on the online description are more detailed, this will not be a fish, will be found in a few manual links here for your reference to learn.

Gitolite's Wiki

Https://github.com/sitaramc/gitolite

A more detailed Gitolite manual

Http://www.ossxp.com/doc/git/gitolite.html

A comparison of GIT rights management scenarios

Http://blog.ihipop.info/2011/09/2720.html

How to migrate from Gitosis to Gitolite

Chinese: http://hansay.com/2012/07/05/migrating-gitosis-to-gitolite-for-ubuntu-12-dot-04/

English: http://www.marcus-povey.co.uk/2013/09/26/migrating-from-gitosis-to-gitolite/ 4. Configure Anonymous access (Public access)

The purpose of this section is to open one or several of Git's repo for anyone to read, without public-key authentication or password authentication. This reference is also a lot of, in accordance with the steps on the Internet can be configured, here just list my configuration process encountered some problems, and I used to think that better reference documents, a total of reference to learn. 4.1. Reference materials

Git-daemon's wiki:

Https://github.com/git/git/blob/master/Documentation/git-daemon.txt

Launch the Git daemon manual

Chinese: http://rline.blog.51cto.com/1703915/1061302

English: http://granjow.net/git-read-access.html

Git-daemon's man page:

https://www.kernel.org/pub/software/scm/git/docs/git-daemon.html 4.2. My question

① directory permissions: In the configuration process, be sure to pay attention to permissions issues, especially to be configured to require public access to the directory. Although I also noticed the permissions, I ignored the requirement that a directory should have permission to run the directory if it has Read permissions. {drwxr--r--} This is not possible, {drwxr-xr-x} this is OK.

② I use the Gitdaemon user-initiated git daemon thread, which results in a clone that can't get the contents of repo because of directory permissions, because after adding content to Git, the default property for the file created on Git server side is {drwx------ , which causes the Gitdaemon user to not be able to read.

③ Although I noticed the top 2nd, but I found that after the administrator to git the new content, other clients through the daemon process access to the public library, still can not get the updated content, after a few troubleshooting found Gitolite has a new Create file Umask settings, in ~/. gitolite.rc file (UMASK)

④ again a comprehensive reference to the document, if the full follow the steps in their own computer configuration will inevitably encounter problems, the best way to find the wrong location is to view the log. The log of the daemon thread can be specified--syslog at startup, so that the log can be viewed in/var/log/syslog. The Gitolite log is in the ~/.gitolite/log/directory.


5. Basic command

Use of fetch and pull http://my.eoe.cn/com360/archive/3533.html

New library http://www.cnblogs.com/xiaoya901109/archive/2012/08/03/2620664.html Full copy of the following command from Http://www.lifeba.org/arch/git_ Gitosis.html

#clone一个项目

git clone ssh://git@lifeba_vps:bqueue.git

Add File to version Library

git add test2.txt

Git commit-m "Add Test2.txt"

git push

Get the latest code

Git pull

git fetch git path

Update file Submission

Git commit-a or git commit-a-e #提交全部修改文件 and call vim Edit submit log.

git push

View status

git status #查看版本库的状态. You can learn which files have changed, which files have not been added to the Git library, and so on. It is recommended that you confirm the library status by using this command before each commit.

View version Control

Git clean-dxf is used to purge files that are not tracked.

Git CLEAN-DNF can display files that need to be deleted, but does not include the. Gitignore ignored.

Conflict resolution

Git rebase

Git add-u indicates that new modifications to all track files are added to the cache, but no new files are added.

Git rebase--continue #有冲突继续解决, repeat these steps until rebase is complete.

If you encounter a patch in the middle that doesn't need to be applied, you can ignore it with the following command:

Git rebase--skip

If you want to go back to the state before rebase execution, you can perform:

Git rebase--abort

Note: After rebase, you do not need to perform a commit, there is no new modification to be submitted, all git is done automatically. 6. Reference materials

(except as already mentioned above)

[1]. Git manual http://git-scm.com/book/zh/%E8%B5%B7%E6%AD%A5

[2]. Build Document http://blog.csdn.net/wirror800/article/details/5189564

[3].  English Document  http://sharadchhetri.com/2013/05/31/ how-to-create-own-git-server-with-gitolite-and-gitweb-in-ubuntu/

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.