Skip to content

Global Git Ignore #2191

Open
Open
@chazmo03

Description

@chazmo03

Describe the problem

When building a project from a template, files that are included in the template that are ignore by a user's global gitignore file (as configured by git's core.excludesFile) will be excluded from the template.

I would expect that files included in the template should be included in the project, regardless of a user's git configuration in their local environment.

One approach to handle this (on git 2.3.1+) could be to override this configuration when running git by using the below environment variables:

GIT_CONFIG_COUNT=1
GIT_CONFIG_KEY=core.excludesFile
GIT_CONFIG_VALUE=""

Template

None

To Reproduce

  1. Create a global gitignore file: echo ".envrc" > ~/.gitignore
  2. Configure git to use said file: git config --global core.excludesFile '~/.gitignore'
  3. Create a template with that file in it: touch .envrc
  4. Run copier copy on that template
  5. The .envrc file will not be in the new project

Logs

Expected behavior

Any file that is in the template will be included in the created project, even if it would be excluded by the global gitignore file.

Screenshots/screencasts/logs

No response

Operating system

Linux

Operating system distribution and version

Ubuntu 22.04

Copier version

9.7.1

Python version

3.13

Installation method

uvx+pypi

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageTrying to make sure if this is valid or not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions