Skip to content

fix: ignore .git folder on template download#13702

Open
singhlovepreet9 wants to merge 1 commit into
serverless:mainfrom
singhlovepreet9:fix-template-git-folder
Open

fix: ignore .git folder on template download#13702
singhlovepreet9 wants to merge 1 commit into
serverless:mainfrom
singhlovepreet9:fix-template-git-folder

Conversation

@singhlovepreet9

@singhlovepreet9 singhlovepreet9 commented Jul 11, 2026

Copy link
Copy Markdown

Fixes #11978

When downloading a template via --template-url, the .git directory from the repository was being copied over, meaning the new project erroneously inherited the remote of the template repository. This fix ensures the .git folder is removed upon template download.

Summary by CodeRabbit

  • Bug Fixes
    • Downloaded service templates no longer retain .git metadata from the source template.
    • Generated templates continue to remove unnecessary template configuration files.

Fixes serverless#11978. When downloading a template, specifically via --template-url, we should ensure the .git directory is not included so the new project doesn't inherit the remote of the template.
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6f73c82-040f-42b3-8e3c-c21b85aecf95

📥 Commits

Reviewing files that changed from the base of the PR and between bd8041d and 88f9236.

📒 Files selected for processing (1)
  • packages/sf-core/src/utils/https/index.js

📝 Walkthrough

Walkthrough

downloadTemplate now removes a copied .git directory from the generated service path after deleting serverless.template.yml, preventing source repository metadata from being retained.

Changes

Template cleanup

Layer / File(s) Summary
Remove copied Git metadata
packages/sf-core/src/utils/https/index.js
downloadTemplate deletes the generated template’s .git directory after removing serverless.template.yml.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: removing .git from downloaded templates.
Linked Issues check ✅ Passed The code change matches issue #11978 by removing copied .git metadata from template downloads.
Out of Scope Changes check ✅ Passed The patch stays focused on template download cleanup and adds no unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

@Mmarzex

Mmarzex commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@singhlovepreet9 singhlovepreet9 marked this pull request as ready for review July 11, 2026 22:04
@singhlovepreet9

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

I have read the CLA Document and I hereby sign the CLA

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.

creating a project from private git repo copies the .git folder

2 participants