It's easier to get started with git and use GitHub more often, but today I'd like to build a service to practice practiced hand. After reading some of the material to cooperate with some verification, only then found that the so-called service and the previous SVN completely different. The process is documented as follows:
Linuxserver-side Install git
I put the service on the Linux machine, this broken machine no apt-get, no yum, had to download the source code, their own compilation
wget http://distfiles.macports.org/git/git-2.5.3.tar.gztar xzvf git-latest. Tar . GZ $ cd git-{date} $ autoconf $. /configure--with-curl=/usr/make doinstall
Fortunately all the way smoothly:
$ git--2.5. 3
Server-side SSH configuration
1) If the client does not create an SSH RSA public key, it is created first:
$ cd ~ssh-keygen -t RSA # Default storage path in ~/. SSH/id_rsa.pub
2) If the client side has been created and there is a ~/.ssh/id_rsa.pub, copy it to the server side:
ssh <username>@<server_ip>:. ssh/authorized_keysid_rsa.pub 416 0. 4KB /s xx:xx
3) Modify the server-side sshd_config:
ssh <username>@<server_ip>etc # some machines in/etc/sudochmod 666vipermitrootlogin No# The following items remove the front #注释 #rsaauthentication yes# Pubkeyauthentication yes#authorizedkeysfile . ssh/usepam no
Test is valid
1) Create an empty repository on the server side
$ cd repo$ git init-bare #-bare flag is only used to store pushes and will not be used as a local repository.
2) Create repository on client side and push
mkdirTouch-<username>@<server_ip>:/repo$ git push origin Master
3) repository just created on client side clone
$ git clone <username>@<server_ip>:/repo Localrepo2
found that the code tree that was just submitted was clone down, indicating a successful build
Since git is distributed and there are no master-slave points, I understand that the so-called Git service is to make sure that you have access to the GIT files on the server. This is unrelated to whether the file is remote or local. In the example above, if I put the server on the local, the same is possible.
Verify that the server is built locally
1) Create an empty repository locally
mkdir ~/~/repo$ git init-bare
2) Create the repository locally and push
mkdir ~/~/Touch-~/repo$ git push Origin master
3) repository just created in local clone
$ git clone ~/repo ~/localrepo2
See ~/LOCALREPO2, sure enough, the readme was cloned.
Resources:
Http://www.cnblogs.com/eileenleung/p/3503337.html
How to get started with Git