
一 CI/CD是什么CI/CD 是指持续集成Continuous Integration和持续部署Continuous Deployment或持续交付 Continuous Delivery1.1 持续集成Continuous Integration持续集成是一种软件开发实践团队成员频繁地将他们的工作集成到共享的代码仓库中。其主要特点包 括1. 频繁提交代码开发人员可以每天多次提交代码确保代码库始终保持最新状态。2. 自动化构建每次提交后自动触发构建过程包括编译、测试、静态分析等。3. 快速反馈如果构建失败或测试不通过能够快速地向开发人员提供反馈以便及时修复问题。1.2 持续部署Continuous Deployment持续部署是在持续集成的基础上将通过所有测试的代码自动部署到生产环境中。其特点如下1. 自动化流程从代码提交到生产环境的部署完全自动化无需人工干预。2. 高频率部署可以实现频繁的部署使得新功能能够快速地提供给用户。3. 风险控制需要有强大的测试和监控体系来确保部署的稳定性和可靠性。1.3 持续交付Continuous Delivery持续交付与持续部署类似但不一定自动部署到生产环境而是随时可以部署。其重点在于确保软件随 时处于可发布状态。CI/CD 的好处包括1. 提高开发效率减少手动操作和等待时间加快开发周期。2. 尽早发现问题通过频繁的集成和测试问题能够在早期被发现和解决。3. 降低风险减少了大规模部署时可能出现的问题提高了软件的质量和稳定性。4. 增强团队协作促进团队成员之间的沟通和协作提高团队的整体效率。常见的 CI/CD 工具包括 Jenkins、GitLab CI/CD、Travis CI 等。这些工具可以帮助团队实现自动化的构建测试和部署流程二 git工具使用2.1 git简介Git 是一个分布式版本控制系统被广泛用于软件开发中以管理代码的版本和变更。主要特点1.分布式每个开发者都有完整的代码仓库副本这使得开发者可以在离线状态下进行工作并且在网络 出现问题时也不会影响开发。即使中央服务器出现故障开发者仍然可以在本地进行开发和查看项目历史。2.高效的分支管理Git 中的分支创建和切换非常快速和简单。开发人员可以轻松地创建新的分支来进行新功能的 开发或修复 bug而不会影响主分支。合并分支也相对容易可以使用多种合并策略来满足不同的需求。3.快速的版本回退如果发现某个版本存在问题可以快速回退到之前的版本。可以查看每个版本的详细变更记录方便了解代码的演进过程。4.强大的提交管理每个提交都有一个唯一的标识符可以方便地引用和查看特定的提交。提交可以包含详细的提交信息描述本次提交的更改内容。5.支持协作开发开发者可以将自己的更改推送到远程仓库供其他开发者拉取和合并。可以处理多个开发者同时对同一文件进行修改的情况通过合并冲突解决机制来确保代码的完 整性。Git必看秘籍 https://git-scm.com/book/zh/v22.2 git 工作流程Git 有三种状态已提交committed、已修改modified 和 已暂存staged。已修改表示修改了文件但还没保存到数据库中。已暂存表示对一个已修改文件的当前版本做了标记使之包含在下次提交的快照中。已提交表示数据已经安全地保存在本地数据库中。这会让我们的 Git 项目拥有三个阶段工作区、暂存区以及 Git 目录。三 部署git3.1 安装git#在rhel9的系统中默认自带git [rootCICD-node1 ~]# dnf install git -y #设定命令补全功能 [rootCICD-node1 timinglee]# echo source /usr/share/bash-completion/completions/git ~/.bashrc [rootCICD-node1 timinglee]# source ~/.bashrc3.2 初始化获取 Git 仓库通常有两种方式将尚未进行版本控制的本地目录转换为 Git 仓库。从其它服务器克隆 一个已存在的 Git 仓库。比如 git clone初始化版本库[rootgitlab ~]# mkdir peng [rootgitlab ~]# cd peng [rootgitlab peng]# git init 提示 使用 master 作为初始分支的名称。这个默认分支名称可能会更改。要在新仓库中 提示 配置使用初始分支名并消除这条警告请执行 提示 提示 git config --global init.defaultBranch 名称 提示 提示 除了 master 之外通常选定的名字有 main、trunk 和 development。 提示 可以通过以下命令重命名刚创建的分支 提示 提示 git branch -m name 已初始化空的 Git 仓库于 /root/peng/.git/ [rootgitlab peng]# ls -a . .. .git [rootgitlab peng]# ls .git/ branches config description HEAD hooks info objects refs #设定用户信息 [rootgitlab peng]# git config --global user.name peng [rootgitlab peng]# git config --global user.email pengpeng.org #查看当前文件状态 [rootgitlab peng]# git status 位于分支 master 尚无提交 无文件要提交创建/拷贝文件并使用 git add 建立跟踪 [rootgitlab peng]# git status -s #简化输出Warning.git目录是git跟踪管理版本库的没事别瞎溜达四 git的使用方法4.1 常用方法[rootCICD-node1 timinglee]# echo timnglee README.md [rootCICD-node1 timinglee]# git status 位于分支 master 尚无提交 未跟踪的文件: 使用 git add 文件... 以包含要提交的内容 README.md 提交为空但是存在尚未跟踪的文件使用 git add 建立跟踪 [rootCICD-node1 timinglee]# git status -s ?? README.md [rootCICD-node1 timinglee]# git add README.md [rootCICD-node1 timinglee]# git status -s A README.md #?? 新建文件未添加到版本库 #A 已添加到暂存区 #提交暂存区的数据 [rootCICD-node1 timinglee]# git commit -m add README.md [master根提交 74625b0] add README.md 1 file changed, 1 insertion() create mode 100644 README.md [rootCICD-node1 timinglee]# git status -s #无任何显示标识已经提交到版本库 #再次修改 [rootCICD-node1 timinglee]# vim README.md timnglee timnglee [rootCICD-node1 timinglee]# git status -s M README.md #右M 表示文件在工作区被修改 #撤销修改 [rootCICD-node1 timinglee]# git checkout -- README.md 从索引区更新了 1 个路径 [rootCICD-node1 timinglee]# cat README.md timnglee #从新修改 [rootCICD-node1 timinglee]# echo timinglee README.md [rootCICD-node1 timinglee]# git add README.md [rootCICD-node1 timinglee]# git status -s M README.md #左M表示文件已经在版本库中并被跟踪 #从暂存区撤销 [rootCICD-node1 timinglee]# git restore --staged README.md [rootCICD-node1 timinglee]# git status -s M README.md #从新提交 [rootCICD-node1 timinglee]# git add README.md [rootCICD-node1 timinglee]# git status -s M README.md #更新 [rootCICD-node1 timinglee]# git commit -m update v1 [master 6a14bb5] update v1 1 file changed, 1 insertion(), 1 deletion(-) [rootCICD-node1 timinglee]# git status -s #更新文件 [rootCICD-node1 timinglee]# echo timinglee README.md [rootCICD-node1 timinglee]# git add README.md [rootCICD-node1 timinglee]# echo timinglee README.md [rootCICD-node1 timinglee]# git status -s MM README.md #MM表示有一部分在暂存区还有一部分没有提 交 #如果现在提交只能提交在暂存区中的部分 [rootCICD-node1 timinglee]# git commit -m update v2 [master dc9b45f] update v2 1 file changed, 1 insertion() [rootCICD-node1 timinglee]# git status -s M README.md #右M还在 #查看已暂存和未暂存的修改变化 [rootCICD-node1 timinglee]# echo timinglee README.md [rootCICD-node1 timinglee]# git diff diff --git a/README.md b/README.md index 62be538..87bd0f6 100644 --- a/README.md b/README.md -1,2 1,3 timinglee timinglee timinglee #跳过使用暂存区只能在提交过的在版本库中存在的文件使用如果文件状态是“”不能用此方法 [rootCICD-node1 timinglee]# git commit -a -m update v3 [master 3579560] update v3 1 file changed, 1 insertion() #撤销工作区中删除动作 [rootCICD-node1 timinglee]# touch lee.txt [rootCICD-node1 timinglee]# git add lee.txt [rootCICD-node1 timinglee]# git commit -m add lee.txt [master 16141e7] add lee.txt 1 file changed, 0 insertions(), 0 deletions(-) create mode 100644 lee.txt [rootCICD-node1 timinglee]# git status -s D lee.txt #右D表示文件在工作区被删除 [rootCICD-node1 timinglee]# git checkout -- lee.txt [rootCICD-node1 timinglee]# ls dir1 lee.txt README.md #从版本库中删除文件 [rootCICD-node1 timinglee]# git rm lee.txt rm lee.txt [rootCICD-node1 timinglee]# git status -s D lee.txt #左D表示文件删除动作被提交到暂存区 [rootCICD-node1 timinglee]# git commit -m delete lee.txt [master 85483db] delete lee.txt 1 file changed, 0 insertions(), 0 deletions(-) delete mode 100644 lee.txt [rootCICD-node1 timinglee]# git status -s #恢复从版本库中被删除的文件 [rootCICD-node1 timinglee]# git log #查看操作日志 commit 85483db3cb7f543950f678b7d04b85daef96c248 (HEAD - master) Author: timinglee timingleetiminglee.org Date: Wed Sep 11 01:52:49 2024 0800 delete lee.txt commit 16141e793a06cdce042e203e5c4a78f8fc92736b Author: timinglee timingleetiminglee.org Date: Wed Sep 11 01:48:45 2024 0800 add lee.txt commit 3579560e8307005cc26cf51f4decfe2024762d4c Author: timinglee timingleetiminglee.org Date: Wed Sep 11 01:46:38 2024 0800 update v3 [rootCICD-node1 timinglee]# git reflog #查看提交动作 85483db (HEAD - master) HEAD{0}: commit: delete lee.txt 16141e7 HEAD{1}: commit: add lee.txt 3579560 HEAD{2}: commit: update v3 dc9b45f HEAD{3}: commit: update v2 6a14bb5 HEAD{4}: commit: update v1 74625b0 HEAD{5}: commit (initial): add README.md #版本回退到删除之前 [rootCICD-node1 timinglee]# git reset --hard 16141e7 HEAD 现在位于 16141e7 add lee.txt [rootCICD-node1 timinglee]# ls dir1 lee.txt README.md4.2 git对于文件如何忽略在做软件开发时对源码编译会产生一些临时文件我们在提交时需要忽略这些临时文件[rootgitlab peng]# mkdir dir1/ [rootgitlab peng]# touch dir1/.file2 [rootgitlab peng]# git status -s ?? dir1/ [rootgitlab peng]# echo .file1 .gitignore [rootgitlab peng]# git status -s ?? .gitignore ?? dir1/ [rootgitlab peng]# echo .* .gitignore [rootgitlab peng]# git status -s五 gitlab代码仓库5.1 gitlab简介GitLab 是一个用于仓库管理系统的开源项目使用 Git 作为代码管理工具并在此基础上搭建起来 的 web 服务。GitLab 具有很多功能比如代码托管、持续集成和持续部署CI/CD、问题跟踪、合并请求管理 等。它可以帮助开发团队更好地协作开发软件项目提高开发效率和代码质量。官网 https://about.gitlab.com/install/中文站点 https://gitlab.cn/install/官方包地址 https://packages.gitlab.com/gitlab/gitlab-ce5.2 gitlab 的部署实施5.2.1 部署gitlab部署gitlab需要内存大于4G#在安装包之前需配置好软件仓库来解决依赖性 [rootCICD-node1 ~]# dnf install -y curl policycoreutils-python-utils openssh-server perl [rootCICD-node1 ~]# [rootgitlab ~]# ls gitlab-ce-18.11.2-ce.0.el9.x86_64.rpm peng [rootgitlab ~]# rpm -ivh gitlab-ce-18.11.2-ce.0.el9.x86_64.rpm 警告gitlab-ce-18.11.2-ce.0.el9.x86_64.rpm: 头V4 RSA/SHA256 Signature, 密钥 ID 82dd593d: NOKEY Verifying... ################################# [100%] 准备中... ################################# [100%] 正在升级/安装... 1:gitlab-ce-18.11.2-ce.0.el9 ################################# [100%] It looks like GitLab has not been configured yet; skipping the upgrade script. . .. :c: ,cc :ccc: cccc. :ccccc, cccccc .ccccccc :cccccc: cccccccc: .cccccccc :ccccccccc;..............cccccccccc cccccccccccccccccccccccccccccccccccccc :ooolccccccccccccccccccccccccccccccllooo ooooooollccccccccccccccccccccccclooooooo ;ooooooooollcccccccccccccccccloooooooool oooooooooooolccccccccccccloooooooooooo. .ooooooooooooolcccccclloooooooooooo; cooooooooooooolllooooooooooooo. loooooooodxkkxddoooooooo. .ooodxkkkkkkkkxdooo; .kkkkkkkkkkkk: ;kkkkkkx :d Thank you for installing GitLab! GitLab was unable to detect a valid hostname for your instance. Please configure a URL for your GitLab instance by setting external_url configuration in /etc/gitlab/gitlab.rb file. Then, you can start your GitLab instance by running the following command: sudo gitlab-ctl reconfigure For a comprehensive list of configuration options please see the Omnibus GitLab readme https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md Help us improve the installation experience, let us know how we did with a 1 minute survey: https://gitlab.fra1.qualtrics.com/jfe/form/SV_6kVqZANThUQ1bZb?installationomnibusrelease18-115.2.2 配置gitla#修改配置文件 [rootCICD-node1 ~]# cd /etc/gitlab/ [rootCICD-node1 gitlab]# ls gitlab.rb [rootCICD-node1 gitlab]# vim gitlab.rb 32 external_url http://172.25.254.80 #自己的IP地址 #修改配置文件后需利用gitlab-crt来生效 [rootCICD-node1 gitlab]# gitlab-ctl reconfigure #执行命令成功后会把所有组件全部启动起来5.2.3 登陆gitlab用户名默认为 root 。如果在安装过程中指定了初始密码则用初始密码登录如果未指定密码则系 统会随机生成一个密码并存储在 /etc/gitlab/initial_root_password 文件中 查看随机密码并使 用 root 用户名登录。注意出于安全原因24 小时后 /etc/gitlab/initial_root_password 会被第一次 gitlab-ctl reconfigure 自动删除因此若使用随机密码登录建议安装成功初始登录成功之后立即修 改初始密码。#查看原始密码 [rootgitlab gitlab]# cat /etc/gitlab/initial_root_password # WARNING: This password is only valid if ALL of the following are true: # • You set it manually via the GITLAB_ROOT_PASSWORD environment variable # OR the gitlab_rails[initial_root_password] setting in /etc/gitlab/gitlab.rb # • You set it BEFORE the initial database setup (typically during first installation) # • You have NOT changed the password since then (via web UI or command line) # # If this password doesnt work, reset the admin password using: # https://docs.gitlab.com/security/reset_user_password/#reset-the-root-password Password: Nk8ZlOXaNULgAVEQsg7qdM062rH7S2MEDOmTjyLobM # NOTE: This file is automatically deleted after 24 hours on the next reconfigure run.浏览器访问IP#设置密码5.3 在gitlab中新建项目上传公钥到gitlab中#生成sshd密钥 [rootCICD-node1 ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub The key fingerprint is: SHA256:QuEqZNMwIrNC3yV1yPMhYBtxqyDO2mcdMH9/D07qjmo rootCICD node1.timinglee.org The keys randomart image is: ---[RSA 3072]---- |.o **.. | |o.o.**o. |o.ooo. . |o...*. . | o. .. S |.. . . . | | | | | |. . o . . | | o E . o | | ....o . . | ----[SHA256]----- [rootCICD-node1 ~]# cat .ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDO2nM6YAYVqCag/AqAipxJFF8rA7Trj5jh16eg9kaiIH6ft CBIQKM2tSbm63j/QLahfZa5sA3EJvXm/9HgWgAuz1f6ATvxasSpTfkrshBnnfFlA2JVzh2EVTkD3rkiJ oOSTs8GVSxotUhPy716qfQI9nnK3oXlQhcLTVxmHTxzNMKG2T8WZyNALnUxevf1LDfBHJZt2DcYET16 wf5BwqMbUQs3TRb2rrlXIzVM1wZDHXHogAQrXUzESWYLQK22BS4c4iHStjzN/v/gqH9T8oTPrAP 9oHifzk8aLrdSKYSZttlYgt7QOEqD5BzaRq/yNxfRm7acvqZY4EhlaK1cw1QAmTYsnqbyWRCzIa/yWtH 02atzVeP65zCeqBIEch7vqR2YG2M8CjCvWgrtps3b1M5Hn9lxzwegXYBxx7vXOrh6M49OdyD7HYpzA1e PhM0VAaauQnHzwlJMNtElz2gVVzk90d1ZcNBvwmBKnjSQ/NZhQXKgxKVWwRA3p0 rootCICD node1.timinglee.org下载项目[rootgitlab gitlab]# git clone git172.25.254.10:root/peng.git 正克隆到 peng... The authenticity of host 172.25.254.10 (172.25.254.10) cant be established. ED25519 key fingerprint is SHA256:vwsyXDARPuExR3xkKYNEs/DHIlRGUqjLoZH5j3nOQFg. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 172.25.254.10 (ED25519) to the list of known hosts. remote: Enumerating objects: 3, done. remote: Counting objects: 100% (3/3), done. remote: Compressing objects: 100% (2/2), done. remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 (from 0) 接收对象中: 100% (3/3), 完成. [rootgitlab gitlab]# ls -R .: gitlab.rb gitlab-secrets.json initial_root_password peng trusted-certs ./peng: README.md ./trusted-certs: [rootgitlab gitlab]# cd peng/ [rootgitlab peng]# ls README.md [rootgitlab peng]# git remote -v origin git172.25.254.10:root/peng.git (fetch) origin git172.25.254.10:root/peng.git (push) [rootgitlab peng]# echo zhazha peng [rootgitlab peng]# git add peng [rootgitlab peng]# git commit -m add peng [main 904b635] add peng 1 file changed, 1 insertion() create mode 100644 peng [rootgitlab peng]# git push -u origin main 枚举对象中: 4, 完成. 对象计数中: 100% (4/4), 完成. 使用 4 个线程进行压缩 压缩对象中: 100% (2/2), 完成. 写入对象中: 100% (3/3), 262 字节 | 262.00 KiB/s, 完成. 总共 3差异 0复用 0差异 0包复用 0来自 0 个包 To 172.25.254.10:root/peng.git a2d5136..904b635 main - main 分支 main 设置为跟踪 origin/main。六 jenkins6.1 jenkins 简介Jenkins是开源CICD软件领导者 提供超过1000个插件来支持构建、部署、自动化 满足任何项 目的需要。Jenkins用Java语言编写可在Tomcat等流行的servlet容器中运行也可独立运行CI(Continuous integration持续集成持续集成强调开发人员提交了新代码之后立刻进行构建、单 元测试CD(Continuous Delivery持续交付) 是在持续集成的基础上将集成后的代码部署到更贴近真实运行环境 (类生产环境)中6.2 部署 jenkins软件下载 https://www.jenkins.io/download/jenkins需要部署在新的虚拟机中Warning jenkins需要部署在新的虚拟机中建议最少4G内存4核心cpu#安装依赖包 [rootjenkins yum.repos.d]# wget -O /etc/yum.repos.d/jenkins.repo \ https://pkg.jenkins.io/rpm-stable/jenkins.repo [rootjenkins yum.repos.d]# dnf install fontconfig java-21-openjdk #安装jenkins [rootjenkins ~]# dnf install jenkins-2.555.1-1.noarch #启动jenkins sudo systemctl daemon-reload #查看原始密码 [rootjenkins ~]# cat /var/lib/jenkins/secrets/initialAdminPasswordNote 建议修改admin的密码在admin的设置中修改即可6.3 jenkins 与gitlab的整合[rootjenkins ~]# dnf install git -y 正在更新 Subscription Management 软件仓库。 无法读取客户身份 本系统尚未在权利服务器中注册。可使用 rhc 或 subscription-manager 进行注册。[rootjenkins ~]# ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa Your public key has been saved in /root/.ssh/id_rsa.pub The key fingerprint is: SHA256:x4grEMPBDWQ7Kx2vz1/5P4LTn8rv6dkNJ1WJbKC4ds rootjenkins The keys randomart image is: ---[RSA 3072]---- | ..o . . . .| | . . o o ..| | o . o . . .| | o . . .o| | . . S E oo.| |.. .o. o . ... | |. ...oo . o o | | .ooo oooo ..| | .o..o.o.*| ----[SHA256]----- [rootjenkins ~]# cat /root/.ssh/id_rsa.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCO3Yq6UWxRBpiTPa4OTxUXdr7ANza2ttY9bPe7YsH4xvAvClNabx5Ts7Wajfr9OZYiP32mSqVW1/yHbfkSMSa0U5HYQKIvNtMg2cL/waiYQ/ppXXBZgaDrb7h7W3R9W3w0dqgJXghQEBcsMs3YD5uGxDSB4WUAUlR09woLQ0eV5pv6x83d8vxqwHcqiq46zN31v9RBxyzTwK0Lby4ZZQU4SGSWYEOTP359kIhGN/ESQV99DTUEC030YcpfajgqBvjdoekskobeVyDonEM7XsFES9iqZpDOCXAygnQNsVKf1ZaPVpCwA/FRSqu2Uhn05X7eqrYS2AffUuFmPiK4krhK6gzpQBiIdtoY0QafCSTve4yG6e/MSGvIbbHyn41SOT5T8BM74arUhh5jRuQP75fSqkDHIUWRNmAhmpy09yPn417AYO63M9ulh/QoSFBrlmubKjGbQuPgxnV03K/CcCP3G7YY7bpEYqQwPpcWUZYLNBd8D/hYZLRITuxk rootjenkins 把此密钥添加到gitlab上即可添加密钥凭据[rootjenkins ~]# cat /root/.ssh/id_rsa #查看私钥添加完成后报错依然存在因为ssh首次连接主机是需要签名认证[rootjenkins ~]# ssh git172.25.254.10 The authenticity of host 172.25.254.10 (172.25.254.10) cant be established. ED25519 key fingerprint is SHA256:vwsyXDARPuExR3xkKYNEs/DHIlRGUqjLoZH5j3nOQFg. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added 172.25.254.10 (ED25519) to the list of known hosts. PTY allocation request failed on channel 0 Welcome to GitLab, root! Connection to 172.25.254.10 closed. #另外可能就是jenkins没有.ssh文件 [rootjenkins ~]# cp -r /root/.ssh /var/lib/jenkins/ [rootjenkins ~]# chown -R jenkins:jenkins /var/lib/jenkins/.ssh [rootjenkins ~]# chmod 700 /var/lib/jenkins/.ssh [rootjenkins ~]# chmod 600 /var/lib/jenkins/.ssh/id_* [rootjenkins ~]# git ls-remote git172.25.254.10:root/peng.git 904b635032c5fb0f66127881101581796fbf8b34 HEAD 904b635032c5fb0f66127881101581796fbf8b34 refs/heads/main [rootjenkins ~]# systemctl restart jenkins.service6.4.genkins 中gitlab触发器的部署与使用在 Jenkins 中配置 GitLab 触发器可以实现代码提交或合并请求时自动触发 Jenkins 流水线6.4.1 安装插件如果需要使用gitlab触发器需要安装gitlab插件。目前使用官方源下载比较吃力可以直接本地部署插件 即可6.4.2.部署自动触发插件加载完毕后在jenkins中选择之前构建的项目并配置自动触发在gitlab中设定6.4.2 测试自动触[rootCICD-node1 ~]# cd /root/timinglee/ [rootCICD-node1 timinglee]# echo hello test testfile [rootCICD-node1 timinglee]# git add testfile [rootCICD-node1 timinglee]# git commit -m testfile v1 [main 7ef8dd8] testfile v1 1 file changed, 1 insertion() create mode 100644 testfile [rootCICD-node1 timinglee]# git push -u origin main 枚举对象中: 4, 完成. 对象计数中: 100% (4/4), 完成. 使用 4 个线程进行压缩 压缩对象中: 100% (2/2), 完成. 写入对象中: 100% (3/3), 311 字节 | 311.00 KiB/s, 完成. 总共 3差异 0复用 0差异 0包复用 0来自 0 个包 To 172.25.254.10:root/timinglee.git c163546..7ef8dd8 main - main 分支 main 设置为跟踪 origin/main。