跳转至

Gitea 使用

创建组织

创建用户

创建用户
image-20240726102805970

创建组织(设置为私有)

创建组织 1 image-20240726102853568
创建组织 2 image-20240726102955297

项目中添加用户

追加用户管理
image-20240726104033247

切换测试用户

切换 DevOps 测试用户
image-20240726103711339

用户个人相关设置

仓库拉取代码 SSH 密钥

添加 SSH 密钥 - 添加以下方法生成的公钥

建议公钥规则

  • 公钥名称为 项目名称 + .pub
  • 推荐使用 ed25519 秘钥,禁止1024位以下的 RSA 秘钥
  • 首先进入自己的密钥目录

    mkdir -p ~/.ssh && cd ~/.ssh

  • 生成自己的密钥对,把引号内替换成自己 项目名

    ssh-keygen -o -a 100 -t ed25519 -f id_ed25519 -C "DevOps@linuxnbg.com"

参考文档: - https://docs.github.com/cn/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent

生成 SSH image-20240726105327267
gitea 添加 SSH image-20240726110053487

代码仓库创建与管理

组织中新建仓库

创建仓库
image-20240726111123132

设置分支保护

分支保护 - 不允许直接推送 main (master 已废弃)
image-20240726111705182

代码仓库使用

拉取代码仓库至本地

使用 git clone 拉取代码至本地
image-20240726112415626

编写代码并推送至远端

1. 编写代码 并推送
git clone <git@cicd-gitea.linuxnbg.com:datarc/iceberg.git>
git config --global user.email "DevOps@example.com"
git config --global user.name "DevOps"
git checkout -b DevOps-test
touch test.txt
git add .
git commit -m "chore: 第一次测试 "
git push origin DevOps-test
编写代码并推送
image-20240726112911185

创建合并请求

1. 创建合并请求 从分支合并到 main 分支
image-20240726113046771

找同事审批代码

2. 找同事审批代码
image-20240726113420261

合并代码

1. 审核完毕、合并代码至主分支
image-20240726113732474

查看合并后代码库

合并完毕、查看代码已经合并至主分支
image-20240726113915380