From 336f19bf507cfdac58374c3c6c684faf1b14bbfd Mon Sep 17 00:00:00 2001 From: Zimy Date: Tue, 26 May 2026 18:01:47 +0800 Subject: [PATCH] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20"G?= =?UTF-8?q?IT\346\212\200\346\234\257.md"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GIT技术.md | 57 ++++++------------------------------------------------ 1 file changed, 6 insertions(+), 51 deletions(-) diff --git a/GIT技术.md b/GIT技术.md index bc9c6f2..e036bb9 100644 --- a/GIT技术.md +++ b/GIT技术.md @@ -16,61 +16,22 @@ sudo apt install gitk git-cola 图形化工具 git config --global user.email "zimyx@.com" git config --global user.name "Your Name" git config --global credential.helper store 全局级别保存凭据,免密 - ``` - - - - -### SSH 免密推送配置(你提供的步骤非常重要) - -配置 SSH 密钥后,可以避免每次推送代码时输入密码: - -#### 1. 生成 SSH 密钥对 +## 基础用法 ``` -ssh-keygen -t rsa -C "your_email@example.com" 也可用用户名 +git status +git add . +git commit -m "更新代码" +git push ``` -按提示完成三次回车即可生成密钥。查看公钥内容: - -``` -cat ~/.ssh/id_rsa.pub -``` - -#### 2. 在 Gitea 中添加 SSH 公钥 - -登录 Gitea Web 界面 → 点击右上角头像 → 设置 → SSH/GPG 密钥 → 添加密钥 → 粘贴公钥内容并保存。 - -#### 3. 修改远程仓库地址为 SSH 格式 - -``` -# 查看当前远程地址 -git remote -v - -# 修改为 SSH 地址 -git remote set-url origin git@gitea.example.com:username/repo.git -``` - -#### 4. 测试 SSH 连接 - -``` -在服务器上创建 zimy 用户并设置密码: -sudo useradd -m -s /bin/bash zimy -sudo passwd zimy 设置密码 -ssh -T zimy@zgene.cn -``` - -首次连接会提示信任主机,输入 `yes` 确认。认证成功后会显示欢迎信息。 - - - -## 分支管理规范 +## 规范 分支类型与命名规范 @@ -218,9 +179,3 @@ git branch -d hotfix/issue-description -``` -git add . -git commit -m "更新代码" -git push -``` -