Git 文件超出了符号链接

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14783847/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:09:16  来源:igfitidea点击:

Git file is beyond a symbolic link

gitsymlink

提问by jayunit100

I've ran into an issue wherein Git believes that a file is beyond a symbolic link, and that, thus, it cannot be version controlled, but it appears to be a real file.

我遇到了一个问题,其中 Git 认为文件超出了符号链接的范围,因此无法对其进行版本控制,但它似乎是一个真实的文件。

[root@r1 h]# stat -f conf/core-site.xml 
  File: "conf/core-site.xml"
    ID: 5c7eb82882a6e866 Namelen: 255     Type: ext2/ext3
Block size: 4096       Fundamental block size: 4096
Blocks: Total: 2735511    Free: 510158     Available: 371202
Inodes: Total: 694960     Free: 597972

Additionally, I've tried "readlink" to show the link pointer, but to no avail.

此外,我试过“readlink”来显示链接指针,但无济于事。

How does Git determine if a file is a symbolic link or not?

Git 如何确定文件是否为符号链接?

回答by Thara Perera

/project/subproject/conf

/项目/子项目/conf

If you need to add the /conf into the main project and add symlinks for subprojects,

如果需要将 /conf 添加到主项目并为子项目添加符号链接,

01) Remove conf from subproject and add to the project, and commit changes.

01) 从子项目中删除 conf 并添加到项目中,并提交更改。

  • cp /project/subproject/conf /project
  • rm /project/subproject/conf
  • commit changes
  • cp /项目/子项目/conf /项目
  • rm /项目/子项目/conf
  • 提交更改

02) Then add the symlink and commit

02)然后添加符号链接并提交

  • cd /project/subproject/
  • ln -s ../conf/ conf
  • commit changes
  • cd /项目/子项目/
  • ln -s ../conf/ conf
  • 提交更改