docs(GOV-003): 配置项目专用 Gitea 远程仓库
This commit is contained in:
@@ -61,6 +61,7 @@ npm run governance:finish -- FEAT-MO-001 market-overview
|
||||
10. 两项 Review 均为 `passed` 后,更新发布说明、回退说明、变更记录和版本号。
|
||||
11. 使用中文 Conventional Commit提交。
|
||||
12. 提交后执行 `npx gitnexus status`;若状态过期,再运行 `npx gitnexus analyze`。
|
||||
13. 本地提交和标签完成后仍不得自动推送;只有用户明确要求时,才向项目专用 Gitea `origin` 推送。
|
||||
|
||||
## 6. 完成定义
|
||||
|
||||
|
||||
@@ -2,7 +2,17 @@
|
||||
|
||||
## 1. 当前策略
|
||||
|
||||
当前只使用本地 Git,不配置 GitHub、不创建 GitHub Actions,也不向任何第三方远程仓库推送。用户安装 Gitea 后,再显式配置 `origin`。
|
||||
本项目使用本地 Git 和用户自建 Gitea,不使用 GitHub,也不创建 GitHub Actions。
|
||||
|
||||
| 配置项 | 值 |
|
||||
|---|---|
|
||||
| Gitea 基础地址 | `https://git.foximao.com/` |
|
||||
| 项目账号 | `FoXiMao` |
|
||||
| 唯一远程仓库 | `https://git.foximao.com/FoXiMao/a-share-analysis.git` |
|
||||
| 远程名 | `origin` |
|
||||
| 配置作用域 | 当前项目 `.git/config` |
|
||||
|
||||
密码不属于项目文档。它不得出现在仓库文件、Git 历史、远程 URL、脚本或命令参数中;首次认证时由 Git 凭据助手请求,并交由 macOS Keychain 保存。
|
||||
|
||||
## 2. 分支与提交
|
||||
|
||||
@@ -18,18 +28,59 @@
|
||||
git config core.hooksPath .githooks
|
||||
```
|
||||
|
||||
## 3. Gitea 接入
|
||||
## 3. Gitea 项目级接入
|
||||
|
||||
Gitea 安装并创建空仓库后,由用户确认地址,再执行:
|
||||
在本项目根目录执行以下项目级配置:
|
||||
|
||||
```bash
|
||||
git remote add origin https://git.foximao.com/FoXiMao/a-share-analysis.git
|
||||
git config --local credential.helper osxkeychain
|
||||
git config --local credential.useHttpPath true
|
||||
git config --local credential.username FoXiMao
|
||||
git config --local remote.pushDefault origin
|
||||
```
|
||||
|
||||
`credential.useHttpPath=true` 让同一 Gitea 域名下不同仓库按路径区分凭据;所有设置使用 `--local`,只写入本项目不可提交的 `.git/config`。禁止使用 `git config --global` 配置本项目账号、凭据助手或默认推送目标。
|
||||
|
||||
只读连通性检查:
|
||||
|
||||
```bash
|
||||
GIT_TERMINAL_PROMPT=0 git ls-remote origin
|
||||
```
|
||||
|
||||
首次需要写权限时,由用户在交互式终端执行推送并输入凭据:
|
||||
|
||||
```bash
|
||||
git remote add origin <用户提供的Gitea仓库地址>
|
||||
git push -u origin main
|
||||
```
|
||||
|
||||
建议在 Gitea 中保护 `main`:禁止强推、要求状态检查通过、要求变更说明关联功能编号。未得到用户提供的地址和授权前,任何代理不得自行添加远程或推送。
|
||||
添加远程和验证连通性不代表授权自动推送。代理只有在用户明确要求推送时才能执行。建议在 Gitea 中保护 `main`:禁止强推、要求状态检查通过、要求变更说明关联功能编号。
|
||||
|
||||
## 4. 版本与标签
|
||||
## 4. 配置检查与移除
|
||||
|
||||
检查当前项目和全局配置的边界:
|
||||
|
||||
```bash
|
||||
git remote -v
|
||||
git config --local --get credential.helper
|
||||
git config --local --get credential.useHttpPath
|
||||
git config --global --get-all credential.helper
|
||||
git config --global --get remote.pushDefault
|
||||
```
|
||||
|
||||
如需解除本项目 Gitea 接入,执行:
|
||||
|
||||
```bash
|
||||
git remote remove origin
|
||||
git config --local --unset credential.helper
|
||||
git config --local --unset credential.useHttpPath
|
||||
git config --local --unset credential.username
|
||||
git config --local --unset remote.pushDefault
|
||||
```
|
||||
|
||||
上述操作只影响本项目。Keychain 中已保存的凭据需要在“钥匙串访问”中按 `git.foximao.com` 单独删除。
|
||||
|
||||
## 5. 版本与标签
|
||||
|
||||
发布使用带注释标签,例如:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user