Fork me on GitHub

Git之Gitosis

Gitosis

Gitosis简介

Github地址

环境说明

1
2
3
4
5
6
[root@linux-node9 ~]# cat /etc/redhat-release
CentOS Linux release 7.2.1511 (Core)
[root@linux-node9 ~]# uname -r
3.10.0-327.el7.x86_64
[root@linux-node9 ~]# uname -m
x86_64

安装及配置Gitosis

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
[root@linux-node9 ~]# git clone git://github.com/res0nat0r/gitosis.git
[root@linux-node9 ~]# cd gitosis/
[root@linux-node9 gitosis]# python setup.py install
[root@linux-node9 gitosis]# useradd \
-r \
-s /bin/sh \
-c 'git version control' \
-d /home/git \
git
[root@linux-node9 gitosis]# mkdir -p /home/git
[root@linux-node9 gitosis]# chown git:git /home/git
[root@linux-node9 ~]# su - git
-sh-4.2$ ls -l
total 0
-sh-4.2$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/git/.ssh/id_rsa):
Created directory '/home/git/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/git/.ssh/id_rsa.
Your public key has been saved in /home/git/.ssh/id_rsa.pub.
The key fingerprint is:
fc:32:e9:fe:4d:97:f5:9b:3c:ea:bd:f6:9a:05:b8:d3 [email protected]
The key's randomart image is:
+--[ RSA 2048]----+
| |
| |
| |
| . . |
| S . . .|
| o o +.|
| + . + E o|
| . o o oo=o|
| .o.. oo=B=|
+-----------------+
-sh-4.2$ ls -l
total 0
-sh-4.2$ cd .ssh/
-sh-4.2$ ls -al
total 8
drwx------ 2 git git 36 Feb 23 22:49 .
drwxr-xr-x 3 git git 17 Feb 23 22:49 ..
-rw------- 1 git git 1679 Feb 23 22:49 id_rsa
-rw-r--r-- 1 git git 409 Feb 23 22:49 id_rsa.pub
-sh-4.2$ gitosis-init <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/
-sh-4.2$ ls -l
total 12
-rw-r--r-- 1 git git 567 Feb 23 22:49 authorized_keys
-rw------- 1 git git 1679 Feb 23 22:49 id_rsa
-rw-r--r-- 1 git git 409 Feb 23 22:49 id_rsa.pub
-sh-4.2$ cd
-sh-4.2$ ls -l
total 0
drwxr-xr-x 2 git git 26 Feb 23 22:49 gitosis
drwxr-xr-x 3 git git 30 Feb 23 22:49 repositories
-sh-4.2$ git clone [email protected]:gitosis-admin.git
▽loning into 'gitosis-admin'...
The authenticity of host '192.168.200.109 (192.168.200.109)' can't be established.
ECDSA key fingerprint is 2a:d8:e2:3a:ff:a5:58:a2:bd:95:4f:24:c2:6c:5f:ef.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.200.109' (ECDSA) to the list of known hosts.

remote: Counting objects: 5, done.
remote: Compressing objects: 100% (4/4), done.
remote: Total 5 (delta 1), reused 5 (delta 1)
Receiving objects: 100% (5/5), done.
Resolving deltas: 100% (1/1), done.
-sh-4.2$
-sh-4.2$ ls -l
total 0
drwxr-xr-x 2 git git 26 Feb 23 22:49 gitosis
drwxrwxr-x 4 git git 49 Feb 23 22:52 gitosis-admin
drwxr-xr-x 3 git git 30 Feb 23 22:49 repositories
-sh-4.2$ cd gitosis-admin/
-sh-4.2$ ls -l
total 4
-rw-rw-r-- 1 git git 97 Feb 23 22:52 gitosis.conf
drwxrwxr-x 2 git git 44 Feb 23 22:52 keydir
-sh-4.2$ cat gitosis.conf
[gitosis]

[group gitosis-admin]
members = [email protected]
writable = gitosis-admin

Gitosis管理

用户管理

Git仓库管理

参考资料

https://git-scm.com/book/zh/v1/%E6%9C%8D%E5%8A%A1%E5%99%A8%E4%B8%8A%E7%9A%84-Git-Gitosis

======================================================
希望各位朋友支持一下

本文作者:dongsheng
本文地址https://mds1455975151.github.io/archives/ad17686.html
版权声明:转载请注明出处!

坚持技术分享,您的支持将鼓励我继续创作!