Skip to content

Git Submodule Symlink for Directory is created as File #6378

Description

@Erik1000

Existing issues matching what you're seeing

  • I was not able to find an open or closed issue matching what I'm seeing

Git for Windows version

git version 2.55.0.windows.5
cpu: x86_64
built from commit: 32c4f7689275d233577576630e1ac5b7eb354eb0
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
rust: disabled
feature: fsmonitor--daemon
gettext: enabled
libcurl: 8.21.0
OpenSSL: OpenSSL 3.5.7 9 Jun 2026
zlib: 1.3.2
SHA-1: SHA1_DC
SHA-256: SHA256_BLK
default-ref-format: files
default-hash: sha1

Windows version

Windows 11

Windows CPU architecture

x86_64 (64-bit)

Additional Windows version information

Microsoft Windows [Version 10.0.26100.9106]

Options set during installation

Editor Option: VIM
Custom Editor Path: 
Default Branch Option: main
Path Option: Cmd
SSH Option: OpenSSH
Tortoise Option: false
CURL Option: WinSSL
CRLF Option: CRLFAlways
Bash Terminal Option: MinTTY
Git Pull Behavior Option: FFOnly
Use Credential Manager: Enabled
Performance Tweaks FSCache: Enabled
Enable Symlinks: Enabled
Enable FSMonitor: Disabled

Other interesting things

No response

Terminal/shell

Powershell

Commands that trigger the issue

# Create a new repo
New-Item -Type "Directory" git_symlink_repo
cd .\git_symlink_repo\
git init

# Add submodule
git submodule add https://github.com/Erik1000/git_symlink_submodule.git
git commit -m "chore: add submodule"

# Now create the symlinks using cmd.exe /c mklink
# (assuming permissions are granted / Developer Mode is active)
# Also ensure core.symlinks is true
git config core.symlinks
# true

# Note that the Powershell New-Item command 
#  New-Item -ItemType SymbolicLink -Name my_dir -Target .\git_symlink_submodule\to_be_included\  
# will create a hardlink and its not possible to create soft links from powershell it seems

# Directory symlink
cmd.exe /c mklink /D "my_dir" ".\git_symlink_submodule\to_be_included"

# File symlink
cmd.exe /c mklink "my_file" ".\git_symlink_submodule\to_be_included\some_file"

# Verify using cmd /A
cmd.exe /c "dir /A"

# You should see:
# <SYMLINKD>     my_dir [C:\...\git_symlink_submodule\to_be_included]
# <SYMLINK>      my_file [C:\...\git_symlink_submodule\to_be_included\some_file]

# Commit the symlinks
git add -A
git commit -m "chore: add symlinks"

# Push the repo
git remote add origin https://github.com/Erik1000/git_symlink_repo.git
git branch -M main
git push -u origin main



Now we clone again:

git clone --recurse-submodules https://github.com/Erik1000/git_symlink_repo.git other_repo


Cloning into 'other_repo'...
remote: Enumerating objects: 7, done.
remote: Counting objects: 100% (7/7), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 7 (delta 1), reused 6 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (7/7), done.
Resolving deltas: 100% (1/1), done.
Submodule 'git_symlink_submodule' (https://github.com/Erik1000/git_symlink_submodule.git) registered for path 'git_symlink_submodule'
Cloning into 'C:/Users/X/Documents/git-bug/other_repo/git_symlink_submodule'...
remote: Enumerating objects: 4, done.
remote: Counting objects: 100% (4/4), done.
remote: Total 4 (delta 0), reused 4 (delta 0), pack-reused 0 (from 0)
Receiving objects: 100% (4/4), done.
Submodule path 'git_symlink_submodule': checked out '5e07b27384b1b5f9110aff1a6bde459fd12cca86'




cd .\other_repo\

cmd.exe /c dir /A
 Volume in drive C is Windows
 Volume Serial Number is X

 Directory of C:\Users\X\Documents\git-bug\other_repo

24.08.2026  17:44    <DIR>          .
24.08.2026  17:44    <DIR>          ..
24.08.2026  17:44    <DIR>          .git
24.08.2026  17:44               130 .gitmodules
24.08.2026  17:44    <DIR>          git_symlink_submodule
24.08.2026  17:44    <SYMLINK>      my_dir [.\git_symlink_submodule\to_be_included]
24.08.2026  17:44    <SYMLINK>      my_file [.\git_symlink_submodule\to_be_included\some_file]


**Note**: The my_dir symlink became `SYMLINK` instead of `SYMLINKD` which breaks the symlink.

Expected behaviour

Git creates a file symbolic link for my_dir

Actual behaviour

It should create a directory symbolic link for my_dir (SYMLINKD

Repository

You can clone https://github.com/Erik1000/git_symlink_repo.git for a minimal repo.

Note that manually deleting the file and dir symlink and recreating them using mklink does not appear a a change to git

cmd.exe /c mklink /D "my_dir" ".\git_symlink_submodule\to_be_included"
cmd.exe /c mklink "my_file" ".\git_symlink_submodule\to_be_included\some_file"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions