|
Outline:
One, foreword
Two, Git server set up
Three, add remote warehouse
Four, far from clones warehouse
Five, summary
Note, testers CentOS 5.5 x86_64, Git server version: git version 1.8.2.1, client version: git version 1.9.2.msysgit.0. All software please download here: http: //msysgit.github.io/.
One, foreword
In a previous post, we basically explained, Git local warehouse management. However, we no longer have to manage the backup files also. Git will seal the deal, hey! That Bo Friends said, you talk on one of the content can be achieved SVN, Git that you have no great thing? Hey, I want to say that in many version control must have the same function, but we have to see something special and useful feature of it, today we have to show you Git special function (one) - remote version library.
We all know that Git is a distributed version of the controller, the same repository can be used on different clients. So, one must master server, so all clients can "clone" of the original version of the library, and each client repository will be the same, hehe. So I say, you want to develop people together must have a Git server. So that other people can clone from serving on a Git server on your own computer, you can submit the respective code repository to a remote server, and you can pull the code submitted by others. It is not very easy to do, hey! The Friends of Bo said, we do not have to build Git server computers than how to do? I just want to say, it is also possible. Because there is a site called GitHub. This site provides management Git repository. You just go to register an account on GitHub site, you can get a free Git remote repository, is not it amazing? Here again we want to thank the open source spirit of open source thanks.
The above has been said more clearly, we have to get people to realize the purpose of Git remote repository development, we have two options:
Build their own Git server
Choose Open Source GitHub
I am here mainly on their own to build a server, after all, the enterprise server is still very easy to find, hehe. As friends without a server you want to use GitHub GitHub we will explain in detail in a later article. Well, here we have to build their own Git server.
Two, Git server set up
Here we have to build Git server, hey! Actually, Git server set up in the previous article already mentioned, let's take a simple demo it for you, hey!
[Root @ test ~] # rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
[Root @ test ~] # yum list
[Root @ test ~] # yum install -y git
[Root @ test ~] # git --version git version 1.8.2.1
Well, here we Git server installation is complete, hehe. Relatively simple!
Three, add remote warehouse
1. Increase the user to run the git git Service
[Root @ test ~] # mkdir -pv / data / git mkdir: created directory `/ data / git '
[Root @ test ~] # useradd -r -d / data / git git
2. Create a git repository and initialize an empty library
[Root @ test git] # cd / data / git /
[Root @ test git] # ls
[Root @ test git] # git init --bare project1.git
Initialized empty Git repository in /data/git/project1.git/
[Root @ test git] # cd project1.git /
[Root @ test project1.git] # ls
branches config description HEAD hooks info objects refs
Through the above command, it will create a bare Git repository, bare warehouse area did not work, because Git repository on the server for shared use, so do not let the user log in directly to the server upswing modify the workspace, general Git repository on the server .git is ending. Then we modify the owner of the directory.
[Root @ test project1.git] # chown -R git.git / data / git / *
[Root @ test project1.git] # ll
total 32
drwxr-xr-x 2 git git 4096 May 20 17:30 branches
-rw-r - r-- 1 git git 66 May 20 17:30 config
-rw-r - r-- 1 git git 73 May 20 17:30 description
-rw-r - r-- 1 git git 23 May 20 17:30 HEAD
drwxr-xr-x 2 git git 4096 May 20 17:30 hooks
drwxr-xr-x 2 git git 4096 May 20 17:30 info
drwxr-xr-x 4 git git 4096 May 20 17:30 objects
drwxr-xr-x 4 git git 4096 May 20 17:30 refs
3. Disable git user login
[Root @ test project1.git] # vim / etc / passwd
[Root @ test project1.git] # cat / etc / passwd | grep git
git: x: 101: 105 :: / data / git: / usr / bin / git-shell
For security reasons we modify the git user's shell. I am here to modify / usr / bin / git-shell. So git users can not log into the system, because we specified the git-shell each time you log will automatically exit, hehe. Well, here we initialize the Git repository is completed. Let us demonstrate the client clone a remote repository ......
Four, cloned from a remote repository
1. The client generates a public key ssh login
2. view the generated public key ssh
3. The generated public key to send the git server (because I'm here so I can manage git server directly scp, and developers can not manage public key to set the git server administrator and related operations)
[Root @ test ~] # cd / data / git /
[Root @ test git] # ls project1.git
[Root @ test git] # ls -a. .. Project1.git
[Root @ test git] # mkdir .ssh
[Root @ test git] # ls project1.git
[Root @ test git] # ls -a. .. Project1.git .ssh
[Root @ test git] # cd .ssh /
[Root @ test .ssh] # vim authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwMU4FKB6NRc3XSoIunWsdvVVuSoncbVb5Al6lB3ciswBVd ++ YmJFhqwkITNGccrO5sycROs9 + Fbjgd6oBSzNuaBtCIbwNNsEyM / henTl2euI3XsnJQ / ITr6c / q0P3WoGl4E2QFQ2kZqs + 1eDC0CgHcBrqvFv1Jr414sVYK9lfZwIF + jDdtaBOrSJuq1Agx9pGUFUEB4tQfkXxsWm / MvOmKAVvduKDE1eenUEL9zzyeELPcSXLe3NOoTjZhkX6EEXxQR1ZiZRFywLpfM4qopZ10to2KIUyVtzw6hx6V3cg7kn40lYVW0EAMATw9dVldwcRUI + kJzJSKUTKDVSwY3 / + Q == root @ CHENMINGQIAN
[Root @ test .ssh] # cat authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAwMU4FKB6NRc3XSoIunWsdvVVuSoncbVb5Al6lB3ciswBVd ++ YmJFhqwkITNGccrO5sycROs9 + Fbjgd6oBSzNuaBtCIbwNNsEyM / henTl2euI3XsnJQ / ITr6c / q0P3WoGl4E2QFQ2kZqs + 1eDC0CgHcBrqvFv1Jr414sVYK9lfZwIF + jDdtaBOrSJuq1Agx9pGUFUEB4tQfkXxsWm / MvOmKAVvduKDE1eenUEL9zzyeELPcSXLe3NOoTjZhkX6EEXxQR1ZiZRFywLpfM4qopZ10to2KIUyVtzw6hx6V3cg7kn40lYVW0EAMATw9dVldwcRUI + kJzJSKUTKDVSwY3 / + Q == root @ CHENMINGQIAN
4. The client clone a remote repository to local
Five, summary
Well, here we are on a remote warehouse management to end here in the next blog, we explain the main Git branch management. |
|
|
|