demo1984s 的个人博客 demo1984s 的个人博客

记录精彩的程序人生

目录
256MB小内存Orange Pi Zero下Armbian安装轻量级Gitolite服务器
/        

256MB小内存Orange Pi Zero下Armbian安装轻量级Gitolite服务器

准备工作

Orange Pi Zero

安装设置

Orange Pi Zero 服务器端上进行安装设置如下。

新建 Git 用户

 1armbian@OPi-Zero:~$ sudo adduser git
 2Adding user `git' ...
 3Adding new group `git' (1001) ...
 4Adding new user `git' (1001) with group `git' ...
 5Creating home directory `/home/git' ...
 6Copying files from `/etc/skel' ...
 7New password:
 8Retype new password:
 9passwd: password updated successfully
10Changing the user information for git
11Enter the new value, or press ENTER for the default
12	Full Name []:
13	Room Number []:
14	Work Phone []:
15	Home Phone []:
16	Other []:
17Is the information correct? [Y/n]
18armbian@OPi-Zero:~$

为了方便,以上设置都采用默认,直接按回车。

下载 Gitolite

 1armbian@OPi-Zero:~$ su git
 2git@OPi-Zero:/home/armbian$ cd
 3git@OPi-Zero:~$ ls
 4git@OPi-Zero:~$ pwd
 5/home/git
 6git@OPi-Zero:~$ git clone https://github.com/sitaramc/gitolite
 7Cloning into 'gitolite'...
 8fatal: unable to access 'https://github.com/sitaramc/gitolite/': GnuTLS recv error (-110): The TLS connection was non-properly terminated.
 9git@OPi-Zero:~$ git clone https://github.com/sitaramc/gitolite
10Cloning into 'gitolite'...
11remote: Enumerating objects: 9718, done.
12remote: Counting objects: 100% (12/12), done.
13remote: Compressing objects: 100% (11/11), done.
14remote: Total 9718 (delta 1), reused 4 (delta 1), pack-reused 9706
15Receiving objects: 100% (9718/9718), 3.04 MiB | 650.00 KiB/s, done.
16Resolving deltas: 100% (6027/6027), done.
17git@OPi-Zero:~$ ls
18gitolite

安装 Gitolite

1git@OPi-Zero:~$ mkdir bin
2git@OPi-Zero:~$ gitolite/install -to /home/git/bin/
3git@OPi-Zero:~$ ls bin/
4commands  gitolite  gitolite-shell  lib  syntactic-sugar  triggers  VERSION  VREF
1git@OPi-Zero:~/gitolite$ ./install
2use the following full path for gitolite:
3	/home/git/gitolite/src/gitolite

仓库配置

Gitolite 管理员客户端生成公钥

 1demo1984s@Demo1984sMacBook-Pro  ~/.ssh  ls
 2known_hosts     known_hosts.old known_hosts_bak
 3 demo1984s@Demo1984sMacBook-Pro  ~/.ssh  ssh-keygen -t rsa
 4Generating public/private rsa key pair.
 5Enter file in which to save the key (/Users/demo1984s/.ssh/id_rsa):
 6Enter passphrase (empty for no passphrase):
 7Enter same passphrase again:
 8Your identification has been saved in /Users/demo1984s/.ssh/id_rsa
 9Your public key has been saved in /Users/demo1984s/.ssh/id_rsa.pub
10The key fingerprint is:
11SHA256:hg4U3BnuI5dyeJ6CNZ/T7ULElFeTbU1L0JFgn4tDmRA demo1984s@Demo1984sMacBook-Pro.local
12The key's randomart image is:
13+---[RSA 3072]----+
14|   ....o   E+*+=+|
15|    .oo   o =.Bo+|
16|    . .  o . = + |
17|   . o o  o . . .|
18|    B O S.   o . |
19|   o % *..    .  |
20|  . . B.. .      |
21|     . ...       |
22|         ..      |
23+----[SHA256]-----+
24 demo1984s@Demo1984sMacBook-Pro  ~/.ssh  ls
25id_rsa          id_rsa.pub      known_hosts     known_hosts.old known_hosts_bak

Orange Pi Zero 服务端导入公钥

 1git@OPi-Zero:~$ ls
 2bin  gitolite  id_rsa.pub
 3git@OPi-Zero:~$ bin/gitolite setup -pk id_rsa.pub
 4hint: Using 'master' as the name for the initial branch. This default branch name
 5hint: is subject to change. To configure the initial branch name to use in all
 6hint: of your new repositories, which will suppress this warning, call:
 7hint:
 8hint: 	git config --global init.defaultBranch <name>
 9hint:
10hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
11hint: 'development'. The just-created branch can be renamed via this command:
12hint:
13hint: 	git branch -m <name>
14Initialized empty Git repository in /home/git/repositories/gitolite-admin.git/
15hint: Using 'master' as the name for the initial branch. This default branch name
16hint: is subject to change. To configure the initial branch name to use in all
17hint: of your new repositories, which will suppress this warning, call:
18hint:
19hint: 	git config --global init.defaultBranch <name>
20hint:
21  1
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"id_rsa.pub" 0L, 0B                                                                                                          0,0-1         All
58  1 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCkrVy+ij00MY62ma7/wxCbkEaBAfI+IxDUNXpu84upx5cvQL98zTXJmSiJKy+RuLVl4KiPfTG/la+yAbbzuOshmiitMZE3dBJxW4hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
59hint: 'development'. The just-created branch can be renamed via this command:
60hint:
61hint: 	git branch -m <name>
62Initialized empty Git repository in /home/git/repositories/testing.git/
63WARNING: /home/git/.ssh missing; creating a new one
64    (this is normal on a brand new install)
65WARNING: /home/git/.ssh/authorized_keys missing; creating a new one
66    (this is normal on a brand new install)

管理员公钥重新生成,可以直接覆盖(id_rsa.pub 可以自定义名称,尤其有多个用户的时候,例如我还有一台 Windows 的机器 win10.pub)

1git@OPi-Zero:~$ bin/gitolite setup -pk id_rsa.pub
2git@OPi-Zero:~$

Gitolite 管理员客户端管理仓库

下载管理员管理配置仓库

1demo1984s@Demo1984sMacBook-Pro  ~/gitolite  git clone git@192.168.101.55:gitolite-admin.git
2Cloning into 'gitolite-admin'...
3remote: Enumerating objects: 10, done.
4remote: Counting objects: 100% (10/10), done.
5remote: Compressing objects: 100% (7/7), done.
6remote: Total 10 (delta 0), reused 0 (delta 0), pack-reused 0
7Receiving objects: 100% (10/10), done.

增加两个仓库 AutoWeepByBleMouse.git、TFTDemoESP32C3.git

 1demo1984s@Demo1984sMacBook-Pro  ~/gitolite  cd gitolite-admin
 2 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master  ls
 3conf   keydir
 4 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master  vi conf/gitolite.conf
 5 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master ±  git add conf/
 6 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master ✚  git commit -m "add AutoWeepByBleMouse.git TFTDemoESP32C3.git"
 7[master 4bf94ee] add AutoWeepByBleMouse.git TFTDemoESP32C3.git
 8 1 file changed, 6 insertions(+)
 9 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin  ↱ master  git push
10Enumerating objects: 7, done.
11Counting objects: 100% (7/7), done.
12Delta compression using up to 8 threads
13Compressing objects: 100% (3/3), done.
14Writing objects: 100% (4/4), 447 bytes | 447.00 KiB/s, done.
15Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
16remote: hint: Using 'master' as the name for the initial branch. This default branch name
17remote: hint: is subject to change. To configure the initial branch name to use in all
18remote: hint: of your new repositories, which will suppress this warning, call:
19remote: hint:
20remote: hint: 	git config --global init.defaultBranch <name>
21remote: hint:
22remote: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
23remote: hint: 'development'. The just-created branch can be renamed via this command:
24remote: hint:
25remote: hint: 	git branch -m <name>
26remote: Initialized empty Git repository in /home/git/repositories/AutoWeepByBleMouse.git/
27remote: hint: Using 'master' as the name for the initial branch. This default branch name
28remote: hint: is subject to change. To configure the initial branch name to use in all
29remote: hint: of your new repositories, which will suppress this warning, call:
30remote: hint:
31remote: hint: 	git config --global init.defaultBranch <name>
32remote: hint:
33remote: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
34remote: hint: 'development'. The just-created branch can be renamed via this command:
35remote: hint:
36remote: hint: 	git branch -m <name>
37remote: Initialized empty Git repository in /home/git/repositories/TFTDemoESP32C3.git/
38To 192.168.101.55:gitolite-admin.git
39   c3cb167..4bf94ee  master -> master

代码提交

三条命令:

1git add .
2git commit -m "add code to TFTDemoESP32C3.git"
3git push

相关链接


标题:256MB小内存Orange Pi Zero下Armbian安装轻量级Gitolite服务器
作者:demo1984s
地址:http://www.demo1984s.com/articles/2022/12/20/1671503739218.html