Skip to content

feat(coder/modules/git-config): set user name and email via git config#737

Open
nrvnrvn wants to merge 2 commits intocoder:mainfrom
nrvnrvn:main
Open

feat(coder/modules/git-config): set user name and email via git config#737
nrvnrvn wants to merge 2 commits intocoder:mainfrom
nrvnrvn:main

Conversation

@nrvnrvn
Copy link

@nrvnrvn nrvnrvn commented Feb 20, 2026

Description

The likes of JetBrains IDEs rely on git config rather than env variables and prompt users upon first commit/push attempts.

Type of Change

  • New module
  • New template
  • Bug fix
  • Feature/enhancement
  • Documentation
  • Other

Module Information

Path: registry/coder/modules/git-config
New version: v1.0.34
Breaking change: [ ] Yes [x] No

Testing & Validation

  • Tests pass (bun test)
  • Code formatted (bun fmt)
  • Changes tested locally

Related Issues

None

…g globally

The likes of JetBrains IDEs rely on git config rather than env variables
and prompt users upon first commit/push attempts.
@blinkagent
Copy link
Contributor

blinkagent bot commented Feb 20, 2026

The new coder_script "git_config_user_email" runs unconditionally, but the existing email env vars are guarded:

count = data.coder_workspace_owner.me.email != "" ? 1 : 0

If the workspace owner has no email, this script will either error in coalesce (both sources empty) or actively set user.email to an empty string via git config --global user.email "" — which is worse than leaving it unset.

Should have the same count guard, matching the pattern already used for the env vars a few lines above:

value = local.git_user_email
count = data.coder_workspace_owner.me.email != "" ? 1 : 0
}
resource "coder_script" "git_config_user_name" {

resource "coder_script" "git_config_user_email" {
  agent_id     = var.agent_id
  run_on_start = true
  display_name = "Configure git user email globally"
  count        = data.coder_workspace_owner.me.email != "" ? 1 : 0
  script       = <<EOT
    #!/bin/bash
    set -o errexit
    set -o pipefail

    git config --global user.email "${local.git_user_email}"
  EOT
}

@DevelopmentCats
Copy link
Contributor

@nrvnrvn Thank you for the contribution.

I will go ahead and test this a bit, but I don't see why it wouldn't work 😸

@DevelopmentCats
Copy link
Contributor

You also would need to bump the versions in the README for this as well.

@nrvnrvn
Copy link
Author

nrvnrvn commented Feb 20, 2026

You also would need to bump the versions in the README for this as well.

this is already done =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants