Git server set up
Git server set up
In the previous chapter we used the remote repository Github, Github disclosed project is free, but if you do not want others to see your project will need to charge.
Then we need to build their own Git server as a private warehouse.
Next we will build Git server Centos Case.
1, install Git
$ yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel $ yum install git
Next we create a git user groups and users used to run git Service:
$ groupadd git $ adduser git -g git
2, create a certificate login
Collect all the user needs to log the public key id_rsa.pub file located in our public key into /home/git/.ssh/authorized_keys file, one per line.
If the file does not create it:
$ cd /home/git/ $ mkdir .ssh $ chmod 700 .ssh $ touch .ssh/authorized_keys $ chmod 600 .ssh/authorized_keys
3, initialization Git repository
First we select a directory as a Git repository, assuming is /home/gitrepo/w3cschoolcc.git, enter the command in the / home / gitrepo directory:
$ cd /home $ mkdir gitrepo $ chown git:git gitrepo/ $ cd gitrepo $ git init --bare w3cschoolcc.git Initialized empty Git repository in /home/gitrepo/w3cschoolcc.git/
The above command creates an empty Git repository, Git repository on the server usually end with .git. Then, the user belongs to the warehouse to git:
$ chown -R git:git w3cschoolcc.git
4, clone warehouse
$ git clone firstname.lastname@example.org:/home/gitrepo/w3cschoolcc.git Cloning into 'w3cschoolcc'... warning: You appear to have cloned an empty repository. Checking connectivity... done.
192.168.45.4 is where Git server ip, you need to modify for your own Git server ip.
So that our Git server installation is complete, then we can disable git user login shell, can be done by editing the / etc / passwd file. Find a line like the following: