在Windows上使用符号链接克隆存储库时会发生什么? [英] What happens when I clone a repository with symlinks on Windows?

查看:141
本文介绍了在Windows上使用符号链接克隆存储库时会发生什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows上添加对符号链接的支持方面存在很多问题。但是,当我在Windows上克隆符号链接库时实际发生了什么?

解决方案

由于 version 1.5.3 git clone git init 将探测目标文件系统的符号链接支持,并相应地为 core.symlinks 设置本地存储库配置,即 false 为FAT或NTFS。 这会创建和提交符号链接,例如在Linux下显示为纯文本文件,其中包含Windows下的链接文本(请参阅

由于 com / git-for-windows / git / releases / tag / v2.10.2.windows.1rel =noreferrer> Git for Windows version 2.10.2 安装程序有启用符号链接支持的明确选项



在Git for Windows的旧版本中,您可以手动将 core.symlinks 设置为 true ,以便Git创建符号链接在以下限制条件下:


  • 符号链接仅适用于Windows Vista及更高版本。

  • 符号链接仅适用于NTFS,而不适用于FAT。

  • 您需要成为管理员和/或拥有 SeCreateSymbolicLinkPrivil ege 权限

  • 默认情况下,远程文件系统上的符号链接处于禁用状态。
  • Windows的符号链接已输入。 / li>
  • 许多程序都不理解符号链接(包括旧版本的Windows资源管理器)。


    更多详细信息可在Git for Windows wiki中找到。



    在旧版Git for Windows中手动将 core.symlinks 手动设置为 true

      $ git reset --hard HEAD的错误信息
    错误:无法创建符号链接目录(函数未执行)
    错误:无法创建符号链接linux-links / this_is_a_symbolic_link_to_file(函数未实现)
    致命:无法将索引文件重置为修订版'头'。

    请注意,JGit客户端在目标文件系统的版本中没有探测到目标文件系统的符号链接支持3.3,所以 core.symlinks 设置回落到系统/全局Git配置。从 3.3版开始 JGit探讨符号链接支持,但似乎太保守,设置 core.symlinks = false 某些情况下其中符号链接实际上将受支持



    您可以结帐 https://github.com/sschuberth/git-playground ,其中包含一些在Linux上创建的用于测试的链接。


    There's been a lot of questions about adding support for symlinks on Windows. But, what actually happens when I clone a repository with symlinks on Windows?

    解决方案

    Since version 1.5.3 of the native Git client git clone and git init will probe the target file system for symlink support and set the local repository configuration for core.symlinks accordingly, i.e. to false for FAT or NTFS. This makes symlinks created and committed e.g. under Linux appear as plain text files that contain the link text under Windows (see the git config documentation on core.symlinks for details).

    Since Git for Windows version 2.10.2 the installer has an explicit option to enable symbolic link support.

    In older versions of Git for Windows you can manually set core.symlinks to true which enabled Git to create symbolic links under the following constraints:

    • Symbolic links are only available on Windows Vista and later.
    • Symbolic links will only work on NTFS, not on FAT.
    • You need to be an admin and / or have the SeCreateSymbolicLinkPrivilege privilege.
    • Symbolic links on remote filesystems are disabled by default.
    • Windows' symbolic links are typed.
    • Many programs do not understand symbolic links (that includes older version of Windows Explorer).

    More details are available in the Git for Windows wiki.

    In older versions of Git for Windows manually setting core.symlinks manually to true after cloning and reset your working tree, you would get error messages similar to

    $ git reset --hard HEAD
    error: unable to create symlink directory (Function not implemented)
    error: unable to create symlink linux-links/this_is_a_symbolic_link_to_file (Function not implemented)
    fatal: Could not reset index file to revision 'HEAD'.
    

    As a side note, the JGit client did not probe the target file system for symlink support until its version 3.3, so the core.symlinks setting was falling back to whatever the system / global Git configuration was. Starting with version 3.3 JGit probes for symlink support but seems to be too conservative, setting core.symlinks = false in some cases where symlinks would be in fact supported.

    You can checkout https://github.com/sschuberth/git-playground which contains a bunch of links created on Linux for testing.

    这篇关于在Windows上使用符号链接克隆存储库时会发生什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆