centos8 platform installation services gitosis

A, git server: Prepare each dependent software needed gitosis

1, confirm the existence of openssh? If not present, the following command to install

[root@yjweb ~]# yum install openssh openssh-server openssh-clients

 

2, install git

[root@yjweb ~]# yum install git

 

Git determine whether the installation was successful?

[root@yjweb ~]# git --version
git version 2.18.2

 

3, install python tool

[root@yjweb ~]# yum install -y python2 python2-setuptools

 

Check the python's setuptools is installed successfully?

[root@yjweb gitosis]# python2 -c "import setuptools"  

If no, this means the installation was successful

If given output, represents the installation fails

 

Note: To use python2 here

Because gitosis initialization needs python2,

If you use python3 will complain

 

Two, git server: Creating a git dedicated service to manage users

1. Create a git user

[root@yjweb ~]# groupadd git
[root@yjweb ~]# useradd -g git git
[root@yjweb ~]# grep git /etc/passwd
git:x:1003:1003::/home/git:/bin/bash

 

2, to ensure that the user has write access to the git git directory

[root@yjweb ~]# chown git:git /home/git
[root@yjweb ~]# ll /home/ | grep git
drwx------ 2 git   git    62 Mar  9 17:00 git

 

Three, git server: Installation gitosis

1, clone gitosis the project to a local source folder

[root@yjweb source]# git clone https://github.com/res0nat0r/gitosis.git
Cloning into 'gitosis'...
remote: Enumerating objects: 734, done.
remote: Total 734 (delta 0), reused 0 (delta 0), pack-reused 734
Receiving objects: 100% (734/734), 147.40 KiB | 29.00 KiB/s, done.
Resolving deltas: 100% (458/458), done.

 

2, installation

[root@yjweb source]# cd gitosis/
[root@yjweb gitosis]# python2 setup.py install

 

Note: To use python2 here

Because gitosis initialization needs python2,

If you use python3 will complain

 

Note: If you see the following prompt indicates that the installation was successful

Finished processing dependencies for gitosis==0.2

 

Four, git server: .ssh directory and generate authority:

[root@yjweb ~]# mkdir -p /home/git/.ssh
[root@yjweb ~]# chmod 700 /home/git/.ssh
[root@yjweb ~]# touch /home/git/.ssh/authorized_keys
[root@yjweb ~]# chown git.git -R /home/git

 

Description: authorized_keys file is used to save the project for the public key gitosis

 

V. DEVELOPMENT Client: generating a key and uploaded to the server

Description: Our client development machine is a machine running ubuntu 19.10

1, create a ssh key

Description: The client here is a ubuntu machine

root@kubuntu:~# ssh-keygen -t rsa

Operation all the way round without the need to enter a password

 

2, checks whether the key pair generation

After completion of the generated key pair can be seen from the .ssh directory

root@kubuntu:~# ls .ssh/
id_rsa  id_rsa.pub  known_hosts

Id_rsa.pub is the public key of which we want to use

 

3, the generated public key to upload the git server

With scp or ftp tool, copy id_rsa.pub to the git server

The / tmp directory

It is assumed here git server's ip address is: 123.124.125.126, port address is 12345

root@kubuntu:~# scp -P 12345 .ssh/id_rsa.pub [email protected]:/tmp/
sysop@123.124.125.126's password: 
id_rsa.pub                                                 100%  566    70.3KB/s   00:00

 

Six, git server: initialization gitosis

1, switch to git account to view the client's public key upload whether or not there?

[root@yjweb ~]# su git
[git@yjweb root]$ ll /tmp/id_rsa.pub
-rw-r--r-- 1 sysop sysop 566 Mar  9 18:46 /tmp/id_rsa.pub 

 

2, initialize the project gitosis

[git@yjweb root]$ gitosis-init < /tmp/id_rsa.pub
Initialized empty Git repository in /home/git/repositories/gitosis-admin.git/
Reinitialized existing Git repository in /home/git/repositories/gitosis-admin.git/

 

3, are initialized in the end what had been done?

Gitosis created a catalog and a library catalog

[git @ yjweb ~ ] $ ls
gitosis  repositories

 

Written content in id_rsa.pub authorized_keys directory under .ssh

[git@yjweb ~]$ cd .ssh
[git@yjweb .ssh]$ more authorized_keys
### autogenerated by gitosis, DO NOT EDIT
command="gitosis-serve root@kubuntu",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty ssh-rsa AAAAB3NzaC1yc2E
...

 

Seven development Client: Clone gitosis-admin project

root @ kubuntu: ~ # git clone ssh: //[email protected]: 12345 / gitosis-admin.git
positive cloned into 'Gitosis-ADMIN' ...
Remote: Enumerating Objects:. 5, DONE.
Remote: a Counting Objects: 100% (5/5), DONE.
Remote: Compressing objects:. 100% (4/4), DONE
Remote: the Total. 5 (Delta 0), the Reused 0 (0 Delta)
received object: 100% (5/5 ), carry out.

 

Gitosis-admin can see that this project has been downloaded to the client's local machine

root@kubuntu:~# ls
gitosis-admin  node_modules  package.json  work

 

Eight clients to view remote settings gitosis-admin project

root@kubuntu:~/gitosis-admin# git remote -v
origin  ssh://[email protected]:12345/gitosis-admin.git (fetch)
origin  ssh://[email protected]:12345/gitosis-admin.git (push)

 

Nine, see the local version of centos

[webop@yjweb ~]$ cat /etc/redhat-release
CentOS Linux release 8.0.1905 (Core) 

 

Ten, gitosis use  

See this one:

 

Guess you like

Origin www.cnblogs.com/architectforest/p/12456655.html