Easy git simple Easy first step

Source: Internet
Author: User
Tags svn git clone

Now git is overwhelming, if you don't have to try it really is out. So I decided to apply git to the new project. Fighting for an afternoon plus another 2 hours, finally finished. Find git really really is very simple, beyond my expectation. But since it is simple, why is it difficult? Because of the previous CVS, svn ideas and habits of the use of a little bit of difficulty.

question one: What is the server version of Git? How to install.

SVN has a svnserver that can be installed directly via Yum or apt-get, so what is the server version of Git? Through Yum search git, only found gitolite and gitosis seem to have a relationship with the server, and Gitosis is now gradually replaced by Gitolite. On the GitHub found Gitolite installation instructions: http://sitaramc.github.com/gitolite/install.html, simple incredible, did it once again found that is really enough, a nonsense did not.

You need to install git before you install Gitolite

# yum-y Install git

The process of installing Gitolite on the server is:

1. Log in as root, create a new Git user, and the user's home directory will be used to store git Repository. This username is not necessarily called git, can be arbitrarily specified, but git is more commonly used, a look at the role of the account to know.

# useradd-d/home/git git
# passwd git

2. Login to the server as git, install Gitolite.

$ git clone https://github.com/sitaramc/gitolite

The above is to get gitolite from GitHub first, in the address of the HTTPS can also be replaced by http or git. Perform the following command to complete the installation:

$ gitolite/install-ln
The above command requires a/home/git/bin directory, and the directory is in the $path variable of the GIT account.
The installation is over, and the next step is to configure it.


question two, how to configure Gitolite?

Prior to using SVN, the Apache configuration was required for HTTP access. So does gitolite need to be configured as well? The answer is certainly yes.

The premise is to first generate SSH public key on the administrator (who is responsible for maintaining git later), I have putty generated on the Win7, named Kmeng.pub, uploaded to the server git on the home directory. Then execute the following command:

$ gitolite SETUP-PK kmeng.pub
Unexpectedly got a bunch of exception information:

Fatal:have Errors but logging failed!

Open log failed:no such file or directory
Die Kmeng.pub must have exactly one line


Consulted the former colleagues, originally because this is generated through the putty, the format is not correct, you need to use the following command to transform the OPENSSH format:

$ ssh-keygen-i-F kmeng_o.pub > Kmeng.pub
$ gitolite setup-pk kmeng.pub

After the command execution is completed, it is generated in the/home/git repositories directory. Kmeng is the name of the administrator and the first user of Git repository.

Now that the configuration is complete, the following is the usage.


question three, since the installation configuration has been completed, how should a new project.

This is really a bit of a surprise to me. Gitolite the maintenance of the server also uses a common repository method. First on the administrator's local computer, clone (equivalent to SVN's checkout) a Gitolite-admin project:

git clone git@192.168.0.100:gitolite-admin

In the local will be checked out a gitolite-admin directory, which contains the Conf and keydir two folders, Conf is to store the user to different repository access to the configuration, and Keydir is the user's public key, Now it contains only the kmeng.pub.

The way to create a new repository is really unexpected. First edit the gitolite.conf in conf, and modify it to:

Repo gitolite-admin MyApp
       rw+        = Kmeng Repo testing rw+        =        @all

The MyApp are new additions, and then execute GIT's commit and push commands to complete the new repository.

$ git commit-a
$ git push

Then login to the server, view/home/git/repositories, found inside a myapp.git directory.


It's just too easy to use git in the future.








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.