From 14be641ad3e870a50d20fe36549ba759343e5e04 Mon Sep 17 00:00:00 2001 From: liam Date: Mon, 9 Feb 2026 14:43:31 +0000 Subject: [PATCH] Docs: Update README with Chinese translation and Mac setup instructions --- README.md | 49 +++++++++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index d973fc9..2d5498e 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,41 @@ -# essay +# 论文仓库 (essay) -Personal essay repository. +个人论文仓库。 -## Getting started +## 快速开始 (Getting started) -- Clone: `git clone http://100.66.1.6:13000/liam/essay.git` -- Add content, then commit and push. +- 克隆仓库:`git clone http://100.66.1.6:13000/liam/essay.git` +- 添加内容,然后提交并推送。 -## Non-interactive HTTP push (credential helper) +## Mac 用户一键配置与克隆 -If you're in an environment without an interactive TTY, `git push` over HTTP can fail because Git -cannot prompt for a username/password. You can pre-load credentials using a credential helper. - -Notes: - -- Do not hardcode passwords in remotes. -- `credential.helper store` saves credentials in plaintext. Prefer a token if your Git server supports it. - -Steps: +在 macOS 终端中执行以下命令,即可完成克隆并配置系统钥匙串(自动记住密码): ```bash -# 1) Make sure the remote URL includes the username +git clone http://liam@100.66.1.6:13000/liam/essay.git && cd essay && git config credential.helper osxkeychain +``` + +*说明:运行后请输入一次密码,后续推送/拉取操作将自动完成验证,无需再次输入。* + +## 非交互式 HTTP 推送(凭证助手) + +如果您处于没有交互式终端(TTY)的环境中(例如自动化脚本),通过 HTTP 进行 `git push` 可能会失败,因为 Git 无法弹出提示框让您输入用户名/密码。您可以使用凭证助手预先加载凭证。 + +**注意:** + +- 请勿在远程 URL 中直接硬编码密码。 +- `credential.helper store` 会以**明文形式**保存凭证。如果您的 Git 服务器支持,建议优先使用 Token。 + +**操作步骤:** + +```bash +# 1) 确保远程 URL 包含用户名 git remote set-url origin http://liam@100.66.1.6:13000/liam/essay.git -# 2) Enable a credential helper +# 2) 启用凭证助手 (存储到文件) git config --global credential.helper "store --file ~/.git-credentials" -# 3) Approve credentials (replace with your own password/token) +# 3) 写入凭证(请将 YOUR_PASSWORD_OR_TOKEN 替换为您的真实密码或 Token) cat > /tmp/git-cred <<'EOF' protocol=http host=100.66.1.6:13000 @@ -36,11 +45,11 @@ EOF git credential approve < /tmp/git-cred rm -f /tmp/git-cred -# 4) Push without prompting +# 4) 执行推送(禁止弹出提示) GIT_TERMINAL_PROMPT=0 git push -u origin main ``` -Cleanup (recommended for shared/temporary machines): +**清理工作(推荐在共享或临时机器上执行):** ```bash rm -f ~/.git-credentials