Home
/
/
/

This guide will show you how to manage your Git configuration in Coder.

Personal git configurations

Coder will create a global git configuration file located at ~/.gitconfig in all newly created workspaces and set the user name and email address using the information associated with the user's Coder account.

This step occurs before coder/configure and personalization, which can be used to override the default .gitconfig created by Coder. If there's already a .gitconfig file, Coder will not recreate a default version when you rebuild an workspace.

We recommend that each Coder user set and modify their personal .gitconfig file using the ~/personalize script.

Preferences defined using individual .gitconfig files take precedence over system-level settings.

System and global git configurations

If you have a set of git configuration instructions that apply to your organization as a whole, you can define and use a system-level git configuration. We suggest adding the system-level .gitconfig directly to the image's Dockerfile:

# Add system-level gitconfig
COPY ["gitconfig", "/etc/gitconfig"]

As you can see from the example, system-level git configurations live under /etc/gitconfig. If present, git applies the settings to each repository. However, any Coder user can override system-level settings using global or worktree git configurations.

For more information on git configuration, refer to the official documentation

See an opportunity to improve our docs? Make an edit.