Repository: vscode
Issue: Git - During repo initialization a gitignore file should be created
Labels: feature-request,git


Type: <b>Bug</b>

When initializing a new repository in the source control view, if no .gitignore exists in the folder, a new .gitignore should be offered in some way (settings by choosing a default, asking the user which one, etc.)

In Visual Studio, when a new git repo is initialized a gitignore is offered to be created if one does not exist.

VS Code version: Code - Insiders 1.92.0-insider (b1c0a14de1414fcdaa400695b4db1c0799bc3124, 2024-07-31T20:34:16.103Z)
OS version: Windows_NT x64 10.0.22621
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz (8 x 3302)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled<br>webnn: disabled_off|
|Load (avg)|undefined|
|Memory (System)|31.84GB (14.82GB free)|
|Process Argv|--crash-reporter-id 5f5d2ab1-465c-4ddc-809d-58d91db5dfb0|
|Screen Reader|no|
|VM|0%|
</details><details><summary>Extensions (102)</summary>

Extension|Author (truncated)|Version
---|---|---
better-comments|aar|3.0.2
tsl-problem-matcher|amo|0.6.2
open-in-github-button|ant|0.1.1
vscode-httpyac|anw|6.14.0
azurite|Azu|3.31.0
npm-intellisense|chr|1.4.5
path-intellisense|chr|2.9.0
esbuild-problem-matchers|con|0.0.3
vscode-markdownlint|Dav|0.55.0
vscode-eslint|dba|3.0.10
npm-browser|den|1.1.4
vsc-material-theme-icons|equ|3.6.1
vscode-open-in-github|fab|2.3.0
azure-storage-explorer|for|0.1.2
visual-nuget|ful|0.2.1
html-preview-vscode|geo|0.2.5
vscode-user-secret-management|gia|1.0.0
codespaces|Git|1.17.2
copilot|Git|1.219.1019
copilot-chat|Git|0.19.2024073102
remotehub|Git|0.62.0
vscode-github-actions|git|0.26.3
vscode-pull-request-github|Git|0.92.0
rest-client|hum|0.25.1
svg|joc|1.5.4
vscode-catch2-test-adapter|mat|4.12.0
render-crlf|med|1.8.1
fluent-icons|mig|0.0.18
dotenv|mik|1.0.1
lipsum-generator|MrA|1.2.3
language-gettext|mro|0.5.0
azure-pipelines|ms-|1.228.0
azure-dev|ms-|0.8.3
vscode-apimanagement|ms-|1.0.8
vscode-azure-github-copilot|ms-|0.1.12
vscode-azureappservice|ms-|0.25.2
vscode-azurecontainerapps|ms-|0.7.0
vscode-azurefunctions|ms-|1.15.1
vscode-azureresourcegroups|ms-|0.9.1
vscode-azurestaticwebapps|ms-|0.12.2
vscode-azurestorage|ms-|0.16.0
vscode-azurevirtualmachines|ms-|0.6.5
vscode-bicep|ms-|0.29.47
vscode-cosmosdb|ms-|0.22.0
vscode-docker|ms-|1.29.1
extension-manifest-editor|ms-|0.1.5
csdevkit|ms-|1.9.53
csharp|ms-|2.41.26
dotnet-interactive-vscode|ms-|1.0.5375021
vscode-dotnet-pack|ms-|1.0.13
vscode-dotnet-runtime|ms-|2.1.1
vscode-dotnet-sdk|ms-|0.8.0
vscode-aks-tools|ms-|1.4.8
vscode-kubernetes-tools|ms-|1.3.16
playwright|ms-|1.1.7
debugpy|ms-|2024.10.0
python|ms-|2024.12.1
jupyter|ms-|2024.7.0
jupyter-keymap|ms-|1.1.2
remote-containers|ms-|0.381.0
remote-ssh|ms-|0.113.2024072315
remote-ssh-edit|ms-|0.86.0
remote-wsl|ms-|0.88.2
vscode-remote-extensionpack|ms-|0.25.0
azure-account|ms-|0.12.0
azure-repos|ms-|0.38.0
azurecli|ms-|0.6.0
cmake-tools|ms-|1.18.44
cpptools|ms-|1.21.5
cpptools-extension-pack|ms-|1.3.0
live-server|ms-|0.4.14
makefile-tools|ms-|0.10.21
powershell|ms-|2024.2.2
remote-explorer|ms-|0.5.2024070409
remote-repositories|ms-|0.40.0
remote-server|ms-|1.6.2024070809
windows-ai-studio|ms-|0.3.3
azurerm-vscode-tools|msa|0.15.12
uuid-generator|net|0.0.5
vscode-jest|Ort|6.2.5
vscode-versionlens|pfl|1.14.2
material-icon-theme|PKi|5.8.0
postman-for-vscode|Pos|1.2.1
quicktype|qui|23.0.170
sqlite-viewer|qwt|0.6.4
vscode-thunder-client|ran|2.24.13
vscode-yaml|red|1.15.0
vscode-marketplace-preview|rob|1.5.1
svg-preview|Sim|2.8.3
code-spell-checker|str|3.0.1
aspire-gen|Tim|0.3.0
base-ext-sample|Tim|0.0.15
dotnet-containerizer|Tim|0.1.2
mympclient|tim|0.1.6
resx-editor|tim|0.2.21
es6-string-html|Tob|2.16.0
cmake|twx|0.0.17
typespec-vscode|typ|0.58.0
application-insights|Vis|0.4.2
vscode-icons|vsc|12.8.0
volar|Vue|2.0.7
cron-tasks|zok|0.1.2

(2 theme extensions excluded)

</details><details>
<summary>A/B Experiments</summary>

```
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscod805cf:30301675
vsaa593:30376534
py29gd2263:31024238
vscaac:30438845
c4g48928:30535728
2i9eh265:30646982
962ge761:30841072
pythongtdpath:30726887
welcomedialog:30812478
pythonnoceb:30776497
asynctok:30898717
dsvsc013:30777762
dsvsc014:30777825
dsvsc015:30821418
pythonregdiag2:30926734
pythonmypyd1:30859725
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30870582
dsvsc016:30879898
dsvsc017:30880771
dsvsc018:30880772
cppperfnew:30980852
pythonait:30973460
da93g388:31013173
a69g1124:31018687
dvdeprecation:31040973
dwnewjupyter:31046869
nb_pri_only:31057983
nativerepl1:31104042
refactort:31084545
pythonrstrctxt:31093868
hdi1a554:31091669
flighttreat:31105043
nativeloc1:31106922

```

</details>

<!-- generated by issue reporter -->