2026-02-09 23:39:35 +08:00
2026-02-10 00:16:17 +08:00

论文仓库 (essay)

个人论文仓库。

快速开始 (Getting started)

  • 克隆仓库:git clone http://100.66.1.6:13000/liam/essay.git
  • 添加内容,然后提交并推送。

Mac 用户一键配置与克隆

在 macOS 终端中执行以下命令,即可完成克隆并配置系统钥匙串(自动记住密码):

git clone http://liam@100.66.1.6:13000/liam/essay.git && cd essay && git config credential.helper osxkeychain

说明:运行后请输入一次密码,后续推送/拉取操作将自动完成验证,无需再次输入。

极简提交 (One-command Push)

配置一个 Git 别名,将 addcommitpush 合并为一条命令:

# 1. 配置身份信息(如果尚未配置)
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

# 2. 配置别名(只需执行一次)
git config --global alias.p '!f() { git add . && git commit -m "$1" && git push; }; f'

以后只需输入:

git p "这里写提交说明"

非交互式 HTTP 推送(凭证助手)

如果您处于没有交互式终端TTY的环境中例如自动化脚本通过 HTTP 进行 git push 可能会失败,因为 Git 无法弹出提示框让您输入用户名/密码。您可以使用凭证助手预先加载凭证。

注意:

  • 请勿在远程 URL 中直接硬编码密码。
  • credential.helper store 会以明文形式保存凭证。如果您的 Git 服务器支持,建议优先使用 Token。

操作步骤:

# 1) 确保远程 URL 包含用户名
git remote set-url origin http://liam@100.66.1.6:13000/liam/essay.git

# 2) 启用凭证助手 (存储到文件)
git config --global credential.helper "store --file ~/.git-credentials"

# 3) 写入凭证(请将 YOUR_PASSWORD_OR_TOKEN 替换为您的真实密码或 Token
cat > /tmp/git-cred <<'EOF'
protocol=http
host=100.66.1.6:13000
username=liam
password=YOUR_PASSWORD_OR_TOKEN
EOF
git credential approve < /tmp/git-cred
rm -f /tmp/git-cred

# 4) 执行推送(禁止弹出提示)
GIT_TERMINAL_PROMPT=0 git push -u origin main

清理工作(推荐在共享或临时机器上执行):

rm -f ~/.git-credentials
git config --global --unset credential.helper
Description
No description provided
Readme 5.7 MiB
Languages
Python 100%