优化 git 全局配置脚本

This commit is contained in:
2025-05-01 11:56:12 +08:00
parent e7dba754eb
commit 93e73e8ff1

View File

@@ -56,7 +56,7 @@ resource "coder_agent" "main" {
chmod 700 ~/.ssh
# 生成 SSH 密钥对,不设置密码
ssh-keygen -t ed25519 -f ~/.ssh/git -N "" -C "${data.coder_workspace_owner.me.email}"
ssh-keygen -t ed25519 -f ~/.ssh/git -N "" -C "${data.coder_workspace_owner.me.name}(${data.coder_workspace_owner.me.email})-${data.coder_workspace.me.name}"
# 创建 SSH 配置文件
cat > ~/.ssh/config <<EOF
@@ -83,13 +83,6 @@ EOF
EOT
env = {
GIT_AUTHOR_NAME = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name)
GIT_AUTHOR_EMAIL = "${data.coder_workspace_owner.me.email}"
GIT_COMMITTER_NAME = coalesce(data.coder_workspace_owner.me.full_name, data.coder_workspace_owner.me.name)
GIT_COMMITTER_EMAIL = "${data.coder_workspace_owner.me.email}"
}
metadata {
display_name = "CPU Usage"
key = "0_cpu_usage"