Files
README/a0_部署gitea.md
T
2026-01-22 20:32:40 +08:00

916 B
Raw Blame History

配置 Git 凭据存储(适用于交互式环境)

git config --global credential.helper store

Git 会将你下一次输入的用户名和密码(或 Personal Access Token)明文保存到 ~/.git-credentials 文件中,格式如下:

https://<username>:<password_or_token>@github.com

之后,Git 在访问相同域名(如 github.com)时会自动读取这个文件中的凭据,不再提示输入。

设置项目邮箱和名称

当前项目

git config user.name "Name"
git config user.email "email@example.com"

全局设置

git config --global user.name "Name"
git config --global user.email "email@example.com"

当账户与文件夹用户id不一致时(如部署在Docker中且目录通过-v挂载)

git config --global --add safe.directory /projectName

或 "*" 关闭所有目录的安全检查

git config --global --add safe.directory "*"