原文链接

简介

git for windows增加了符号链接的支持,其大体实现方法为,使用Windows Vista起增加的NTFS符号链接功能,模拟Linux下的符号链接,在使用git管理文件的过程中,由git在不同情况下自动转换。

本文正文翻译自git for windows的wiki文章Symbolic Links

相关链接:
创建符号链接
替换进程级令牌,对应下文原文中的Access Token Change
正文:符号链接

短版本:在Windows下没有和POSIX symlink完全等价的机制,而最为接近的解决办法,在Windows默认的非管理员用户下,是不可使用的。因此,symlink模拟支持默认是关闭的,需要用户手动配置。用户可以通过 core.symlinks=true来配置设置。
背景

从Windows Vista开始,Windows包含了对符号链接的支持。但这不是Unix的符号链接;它们在以下方面有所不同:

符号链接仅在Windows Vista及更新版本中支持,不包含XP。
你需要SeCreateSymbolicLinkPrivilege权限,这一权限默认只有Administrator拥有,但可以通过本地安全策略(Local Security Policy)或通过Active Directory使得普通用户也有这一权限。家庭版的Windows Vista和Windows 7没有本地安全策略,但免费的Polsedit可用于这些版本。注意,即使设置了权限分配,Administrator组的用户仍然需要UAC许可(更多细节在Access Token Change)。
在远程文件系统中,符号链接默认被禁用(可以通过命令fsutil behavior query SymlinkEvaluation来查看)
符号链接仅适用于NTFS,不适用于FAT
Windows下的符号链接是分类型的:它们需要知道它们指向的是文件夹还是文件(因此,Git发现错误时会自动更新类型)
许多程序不能支持符号链接

由于这些原因,Git for Windows默认禁用了对符号链接的支持(但遇到符号链接时Git仍能够读取)。你可以通过core.symlink配置变量来开启对符号链接的支持,例如,当克隆仓库时:

git clone -c core.symlinks=true <URL>

创建符号链接

默认情况下,Git Bash中的ln -s命令并非创建符号链接,而是创建复制。
若需要创建符号链接(需保证你的账户有相应的权限),使用mklink.exe,例如:

mklink /d this-link-points-to c:that-directory
mklink this-link-points-to c:that-file

允许非管理员用户创建符号链接

运行gpedit.msc(组策略编辑器),并增加账号到:计算机配置Windows设置安全设置本地策略用户策略用户权限分配创建符号链接
原文:Symbolic Links

thing is unavailable for non-admins by default. Therefore, symlink emulation support is switched off by default and needs to be configured by you, the user, via the core.symlinks=true config setting.
Background

Starting with Windows Vista, there is support for symbolic links. These are not your grandfather's Unix symbolic links; They differ in quite a few ways:

Symbolic links are only available on Windows Vista and later, most notably not on XP
You need the SeCreateSymbolicLinkPrivilege
privilege, which is by default assigned only to Administrators but can be assigned to normal users using Local Security Policy (or via Active Directory). Home Editions of Windows Vista and Windows 7 do not have Local Security Policy, but the freely available Polsedit (http://www.southsoftware.com) can be used on these editions. Note that regardless of privilege assignment, members of the Administrators group will also require UAC elevation (see the full details in Access Token Changes just above https://msdn.microsoft.com/en-us/library/bb530410.aspx#vistauac_topic4)
Symbolic links on remote filesystems are disabled by default (call fsutil behavior query SymlinkEvaluation to find out)
Symbolic links will only work on NTFS, not on FAT
Windows' symbolic links are typed: they need to know whether they point to a directory or to a file (for this reason, Git will update the type when it finds that it is wrong)
Many programs do not understand symbolic links

For those reasons, Git for Windows disables support for symbolic links by default (it will still read them when it encounters them). You can enable support via the core.symlinks config variable, e.g. when cloning:

git clone -c core.symlinks=true <URL>

Creating symbolic links

By default, the ln -s command in Git Bash does not create symbolic links. Instead, it creates copies.

To create symbolic links (provided your account has permission to do so), use the mklink.exe tool, like so:

mklink /d this-link-points-to c:that-directory
mklink this-link-points-to c:that-file

Allowing non-administrators to create symbolic links

Launch gpedit.msc (i.e. the group policy editor) and add the account(s) to Computer configurationWindows SettingSecurity SettingsLocal PoliciesUser Rights AssignmentCreate symbolic links.

问题症状
登录Ubuntu系统,查看网络配置。系统显示类似如下,说明没有启用IPv6。
1.png
注:启用了IPv6会显示 inet6 addr。

解决方案

执行如下命令,查看配置文件。

grep ipv6 /etc/sysctl.conf

系统返回类似如下。
2.png
编辑 /etc/sysctl.conf文件,修改如下参数。

net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1

将1改成0,如下所示。

net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0

执行如下命令,使配置生效。

sysctl -p

执行如下命令,查看IPv6地址。

ifconfig

系统显示类似如下,说明IPv6已经启用。
3.png

{
// 使用 IntelliSense 了解相关属性。 
// 悬停以查看现有属性的描述。
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "Debug (OpenOCD)",
        "type": "cortex-debug",
        "request": "launch",
        "armToolchainPath": "C:/Program Files (x86)/GNU Tools ARM Embedded/8 2019-q3-update/bin",
        "servertype": "openocd",
        "cwd": "${workspaceRoot}",
        "executable": "./zephyr/zephyr.elf",
        "device": "STM32F103VC",
        "configFiles": [
            "./boards/arm/stm32f1_board/support/openocd.cfg"
        ]
    }
]

}