TechBuzzPro

Gitignore Not Showing in VS Code Explorer? Fix It

· 6 min read · Apps & Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

If your .gitignore file is not appearing in the VS Code file explorer, the cause is almost always one of three things: the file was never actually created, VS Code is hiding it through its own files.exclude setting, or the file is being filtered out by the explorer's exclude pattern for dotfiles. The fastest fix is to open the integrated terminal, run ls -a (macOS/Linux) or dir /a (Windows) to confirm the file exists, then check Settings > files.exclude and remove any pattern that matches .gitignore. If the file is genuinely missing, create it with touch .gitignore or echo.>.gitignore and it will appear in the explorer immediately.

This guide walks through confirming whether the file exists, checking the two VS Code settings that hide it, and troubleshooting the cases where the file is present but the explorer still refuses to show it. Menu labels can differ slightly by VS Code version, operating system, or region, so if a label does not match exactly, look for the closest equivalent.

What You'll Need

  • VS Code installed and the project folder opened (not just a single file).
  • Access to the integrated terminal in VS Code (View > Terminal, or Ctrl+` on Windows/Linux, Cmd+` on macOS).
  • Basic familiarity with the file explorer sidebar on the left.
  • Optional: Git installed if you want to verify ignore rules are working.

Step-by-Step

  1. Confirm the file actually exists on disk. Open the integrated terminal (View > Terminal) and run ls -a on macOS/Linux or dir /a on Windows. The -a and /a flags show hidden files, including dotfiles. If .gitignore is not listed, it was never created — skip to step 3. If it is listed, continue to step 2.
  2. Check VS Code's own exclude setting. Open Settings with Ctrl+, (Cmd+, on macOS) and search for files.exclude. This setting controls which files the explorer hides. If you see a pattern like **/.gitignore or a wildcard such as **/.*, that is why the file is invisible. Remove the offending pattern or set it to false, then close and reopen the explorer. The file should reappear.
  3. Create the file if it is missing. In the terminal, run touch .gitignore on macOS/Linux or echo.>.gitignore in Windows Command Prompt (or New-Item .gitignore in PowerShell). Alternatively, right-click in the explorer, choose New File, and type .gitignore exactly. VS Code will create it and show it in the tree.
  4. Check the explorer's exclude filter. At the top of the Explorer panel there is a filter icon (sometimes labeled "Filter" or shown as a funnel). If a filter string is active, it can hide dotfiles. Clear the filter box and the file should return.
  5. Verify the workspace root. Make sure you opened the folder that contains .gitignore, not a parent or child folder. Use File > Open Folder and select the correct directory. The explorer only shows files under the opened root.
  6. Reload the window. Press Ctrl+Shift+P (Cmd+Shift+P on macOS), type Developer: Reload Window, and press Enter. This refreshes the explorer without closing VS Code and often resolves stale display issues.
  7. Confirm Git is tracking the file (optional). In the terminal, run git status. If .gitignore appears as untracked or modified, Git sees it. If Git does not see it, the file may be outside the repository root — move it to the top level of the repo.

Common Mistakes

  • Creating the file with a different name. Typing gitignore without the leading dot creates a normal file that Git ignores. The dot is required.
  • Editing files.exclude but not search.exclude. These are separate settings. Hiding a file from search does not hide it from the explorer, and vice versa. Check both if the file is missing in one place but not the other.
  • Confusing .gitignore with .git/info/exclude. The latter is a local ignore file inside the .git directory and is not meant to appear in the explorer. Only .gitignore at the project root is the file you normally edit.
  • Assuming the file is hidden when it is just scrolled out of view. Long file trees can push dotfiles below the fold. Collapse folders or use the explorer's filter to search for .gitignore by name.
  • Using a global ignore pattern that matches everything. A pattern like .* in files.exclude hides all dotfiles, including .gitignore, .env, and .eslintrc. Remove it if you need to see them.

Tips

  • Keep files.exclude minimal. Hiding build output like node_modules is fine, but hiding all dotfiles makes configuration files hard to find.
  • Use the Quick Open palette (Ctrl+P or Cmd+P) and type .gitignore to jump straight to the file even if the explorer hides it.
  • If you work across multiple projects, set exclude patterns per workspace rather than globally so one project's settings do not hide files in another.
  • Remember that .gitignore only affects untracked files. Files already tracked by Git remain tracked even if you add them to .gitignore later; you must untrack them explicitly with git rm --cached.

Troubleshooting

The file exists in the terminal but not in the explorer. Recheck files.exclude and the explorer filter. Also confirm you are looking at the correct folder in the sidebar — VS Code may have multiple root folders open in a workspace.

I removed the exclude pattern but the file still does not show. Reload the window with Developer: Reload Window. If that fails, close VS Code completely and reopen the folder.

The file shows in the explorer but Git ignores it. That is expected if the file is empty or if it is itself listed in another ignore file. Check git check-ignore -v .gitignore to see which rule is matching.

I cannot create a file starting with a dot. Some file managers block dotfiles by default. Create it from the VS Code terminal instead, or use the New File command in the explorer and type the full name including the dot.

The explorer shows a file called .gitignore but it is greyed out. Greyed-out files are ignored by Git, not hidden by VS Code. This is normal for files matched by ignore rules. If you need to edit it, double-click it — it is still editable.

Frequently Asked Questions

Why is my .gitignore file not visible in VS Code?

Most often because VS Code's files.exclude setting contains a pattern that matches dotfiles, or because the file was never created. Check the terminal first, then the setting.

Does VS Code hide dotfiles by default?

No. VS Code shows dotfiles by default. If yours are hidden, a setting or filter was changed, either globally or in the workspace.

How do I show hidden files in the VS Code explorer?

Open Settings, search for files.exclude, and remove any pattern that hides the files you want to see. Also clear the explorer filter box at the top of the sidebar.

Can I edit .gitignore if I cannot see it?

Yes. Use Quick Open (Ctrl+P or Cmd+P) and type the filename, or open it from the integrated terminal with a command-line editor. The file does not need to be visible in the explorer to be edited.

Why does .gitignore not appear in Git status?

Git does not list ignored files in git status by default. If .gitignore itself is untracked, it should appear. If it does not, it may be listed in another ignore file or outside the repository root.

Does the .gitignore file need to be at the project root?

It works at any level, but rules apply relative to the folder containing the file. Placing it at the repository root is the common convention and makes the rules apply project-wide.