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

记录精彩的程序人生

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

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

准备工作

Orange Pi Zero

安装设置

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

新建 git 用户

armbian@OPi-Zero:~$ sudo adduser git
Adding user `git' ...
Adding new group `git' (1001) ...
Adding new user `git' (1001) with group `git' ...
Creating home directory `/home/git' ...
Copying files from `/etc/skel' ...
New password:
Retype new password:
passwd: password updated successfully
Changing the user information for git
Enter the new value, or press ENTER for the default
	Full Name []:
	Room Number []:
	Work Phone []:
	Home Phone []:
	Other []:
Is the information correct? [Y/n]
armbian@OPi-Zero:~$

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

下载Gitolite

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

安装Gitolite

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

仓库配置

Gitolite管理员客户端生成公钥

demo1984s@Demo1984sMacBook-Pro  ~/.ssh  ls
known_hosts     known_hosts.old known_hosts_bak
 demo1984s@Demo1984sMacBook-Pro  ~/.ssh  ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/demo1984s/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/demo1984s/.ssh/id_rsa
Your public key has been saved in /Users/demo1984s/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:hg4U3BnuI5dyeJ6CNZ/T7ULElFeTbU1L0JFgn4tDmRA demo1984s@Demo1984sMacBook-Pro.local
The key's randomart image is:
+---[RSA 3072]----+
|   ....o   E+*+=+|
|    .oo   o =.Bo+|
|    . .  o . = + |
|   . o o  o . . .|
|    B O S.   o . |
|   o % *..    .  |
|  . . B.. .      |
|     . ...       |
|         ..      |
+----[SHA256]-----+
 demo1984s@Demo1984sMacBook-Pro  ~/.ssh  ls
id_rsa          id_rsa.pub      known_hosts     known_hosts.old known_hosts_bak

Orange Pi Zero服务端导入公钥

git@OPi-Zero:~$ ls
bin  gitolite  id_rsa.pub
git@OPi-Zero:~$ bin/gitolite setup -pk id_rsa.pub
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Initialized empty Git repository in /home/git/repositories/gitolite-admin.git/
hint: Using 'master' as the name for the initial branch. This default branch name
hint: is subject to change. To configure the initial branch name to use in all
hint: of your new repositories, which will suppress this warning, call:
hint:
hint: 	git config --global init.defaultBranch <name>
hint:
  1
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"id_rsa.pub" 0L, 0B                                                                                                          0,0-1         All
  1 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDCkrVy+ij00MY62ma7/wxCbkEaBAfI+IxDUNXpu84upx5cvQL98zTXJmSiJKy+RuLVl4KiPfTG/la+yAbbzuOshmiitMZE3dBJxW4hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: 	git branch -m <name>
Initialized empty Git repository in /home/git/repositories/testing.git/
WARNING: /home/git/.ssh missing; creating a new one
    (this is normal on a brand new install)
WARNING: /home/git/.ssh/authorized_keys missing; creating a new one
    (this is normal on a brand new install)

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

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

Gitolite管理员客户端管理仓库

下载管理员管理配置仓库

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

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

demo1984s@Demo1984sMacBook-Pro  ~/gitolite  cd gitolite-admin
 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master  ls
conf   keydir
 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master  vi conf/gitolite.conf
 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master ±  git add conf/
 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin   master ✚  git commit -m "add AutoWeepByBleMouse.git TFTDemoESP32C3.git"
[master 4bf94ee] add AutoWeepByBleMouse.git TFTDemoESP32C3.git
 1 file changed, 6 insertions(+)
 demo1984s@Demo1984sMacBook-Pro  ~/gitolite/gitolite-admin  ↱ master  git push
Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 8 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (4/4), 447 bytes | 447.00 KiB/s, done.
Total 4 (delta 0), reused 0 (delta 0), pack-reused 0
remote: hint: Using 'master' as the name for the initial branch. This default branch name
remote: hint: is subject to change. To configure the initial branch name to use in all
remote: hint: of your new repositories, which will suppress this warning, call:
remote: hint:
remote: hint: 	git config --global init.defaultBranch <name>
remote: hint:
remote: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
remote: hint: 'development'. The just-created branch can be renamed via this command:
remote: hint:
remote: hint: 	git branch -m <name>
remote: Initialized empty Git repository in /home/git/repositories/AutoWeepByBleMouse.git/
remote: hint: Using 'master' as the name for the initial branch. This default branch name
remote: hint: is subject to change. To configure the initial branch name to use in all
remote: hint: of your new repositories, which will suppress this warning, call:
remote: hint:
remote: hint: 	git config --global init.defaultBranch <name>
remote: hint:
remote: hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
remote: hint: 'development'. The just-created branch can be renamed via this command:
remote: hint:
remote: hint: 	git branch -m <name>
remote: Initialized empty Git repository in /home/git/repositories/TFTDemoESP32C3.git/
To 192.168.101.55:gitolite-admin.git
   c3cb167..4bf94ee  master -> master

代码提交

三条命令:

git add .
git commit -m "add code to TFTDemoESP32C3.git"
git push

相关链接


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