简体   繁体   中英

Shared Git config between Windows and Ubuntu Git client: symlink versioning issue

I have a PHP project in remote git repository, including symlinks. I have Ubuntu virtual machine installed on Windows host.

The project is cloned, from Ubuntu git client, in a shared folder of VirtualBox. In this way the project is accessible from Windows too with PHPStorm.

By Ubuntu side:

(I have not edited gitconfig)

> git config -l
core.symlinks = false

Symbolic links properly works.

By Windows side:

(I have not edited gitconfig)

> git config -l 
core.symlinks = false

It's not required symbolic links to be converted in Windows link, they are not needed to work under Windows.

As per https://git-scm.com/docs/git-config :

core.symlinks

If false, symbolic links are checked out as small plain files that contain the link text. git-update-index[1] and git-add[1] will not change the recorded type to regular file. Useful on filesystems like FAT that do not support symbolic links.

The default is true, except git-clone[1] or git-init[1] will probe and set core.symlinks false if appropriate when the repository is created.

So I expect that, by Windows side, git client manage symbolic links as text files.

But: if I remove symlink by Ubuntu side, and create the same exactly (still by Ubuntu side), then by Windows side PHPStorm list this symlink as change to be committed . Moreover, it is unknown file type .

What I'm missing? Thank you

I have already seen the following Q/A, that are useful but not resolved in my case:

The setting core.symlink indicates your platform's support for symbolic links. It is automatically detected when you create a repository locally, and it is a cached setting for the platform support.

You should not change this setting.

If you change this setting, then you would have told git that you do not support symbolic links. You have then created a symbolic link, despite claiming to have a system that doesn't support them.

In this case, though, you're having trouble because you're trying to share your repository between two machines. You cloned or init ed the repository on a machine that did not have support for symbolic links (the Windows machine), so core.symlinks was set to false . Therefore your repository does not support symbolic links .

So when a symbolic link is detected , git it telling you that there is a mismatch between what your repository supports and what your working directory has .

Your tools are telling you that you have a problem.

If you need to support symbolic links, then you should probably enable symbolic link support on Windows . However this is likely not the last problem you will have trying to share a Git repository between these two systems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM