Fix gitattributes template missing from source-built distributions#53062
Draft
Fix gitattributes template missing from source-built distributions#53062
Conversation
Co-authored-by: baronfel <573979+baronfel@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issue where dotnet new gitattributes emits no file
Fix gitattributes template missing from source-built distributions
Feb 17, 2026
This was referenced Feb 18, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
.gitattributestemplate content file containsexport-ignorerules that cause it to exclude itself from git archives due to attribute precedence (file-level rules override repo root). Source-built distributions (Fedora, NixPkgs) usegit archiveand were missing this file.Changes
.gitattributes→gitattributes_filesources.renameconfiguration intemplate.jsonto restore.gitattributesname on instantiationgitattributesand.gitattributes)The renamed file bypasses git attribute processing during archive creation while the template engine handles the rename at instantiation time.
{ "sources": [ { "rename": { "gitattributes_file": ".gitattributes" } } ] }Original prompt
This section details on the original issue you should resolve
<issue_title>[10.0.101]
dotnet new gitattributesemits no file</issue_title><issue_description><!--
Please keep in mind that the GitHub issue tracker is not intended as a general support forum, but for reporting non-security bugs and feature requests.
If you believe you have an issue that affects the SECURITY of the platform, please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
For other types of questions, consider using StackOverflow.
-->
Describe the bug
No file was created after
dotnet new gitattributesTo Reproduce
Exceptions (if any)
Further technical details
details of dotnet --info
<agent_instructions>The gitattributes content file needs to be renamed away from
.gitattributes, and in the template.json for that template we need to use a name transform to ensure that the generated file is called.gitattributes.</agent_instructions>Comments on the Issue (you are @copilot in this section)
@marcpopMSFT Didn't repro for me on windows. Linux only issue? @marcpopMSFT Triage: We tried this on ubuntu and it did make the file. Are you running `ls -la` or `ls .gitattributes` to show hidden files as that file is hidden by default on non-windows so maybe it's there but you can't see it? @baronfel It looks like we added this gitattributes template only in 10.0.100, so not having it on 9.0.xxx makes sense to me. @marcpopMSFT Triage: The original issue report said you were using 10.0.101 but later you said the official tar.gz install worked. What install of the .NET SDK are you seeing this not work on? Sounds like it's a product construction issue rather than SDK issue if it works in one version of 10.0.101 but not a different version. @marcpopMSFT Triage: This is likely some ...dotnet new gitattributesemits no file #52307💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.