git GIT_DISCOVERY_ACROSS_FILESYSTEM 未设置

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16853624/
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-10 16:17:58  来源:igfitidea点击:

GIT_DISCOVERY_ACROSS_FILESYSTEM not set

gitfilesystemsboundary

提问by user755

I have searched and read few post but my problem is not the same as descirbed. So here's the issue: using git clone into folder under external partition of the disk works fine but all git commands fails. can't execute git status or git log... I always get error

我搜索并阅读了一些帖子,但我的问题与描述的不同。所以这里的问题是:使用 git clone into 磁盘外部分区下的文件夹工作正常,但所有 git 命令都失败。无法执行 git status 或 git log ... 我总是收到错误

fatal: Not a git repository (or any parent up to mount parent /home/kozi) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

致命:不是 git 存储库(或任何可以挂载父级 /home/kozi 的父级)在文件系统边界处停止(未设置 GIT_DISCOVERY_ACROSS_FILESYSTEM)。

Please help me out..

请帮帮我..

.
├── abi
├── bionic
├── bootable
├── build
├── cts
├── dalvik
├── development
├── device
├── docs
├── external
├── frameworks
├── gdk
├── hardware
├── libcore
├── libnativehelper
├── ndk
├── packages
├── pdk
├── prebuilts
├── .repo
├── sdk
├── system
└── tools

.
├── abi
├── bionic
├── bootable
├── build
├── cts
├── dalvik
├── development
├── device
├── docs
├── external
├── frameworks
├── gdk
├─ ─ 硬件
├── libcore
├── libnativehelper
├── ndk
├── 包
├── pdk
├── prebuilts
├── .repo
├── sdk
├── system
└── 工具

回答by mnafricano

Just type git initinto your command line and press enter. Then run your command again, you probably were running git remote add origin [your-repository].

只需git init在命令行中输入并按回车键即可。然后再次运行您的命令,您可能正在运行git remote add origin [your-repository].

That shouldwork, if it doesn't, just let me know.

应该可以,如果不行,请告诉我。

回答by William Crighton

ran across this page and several like it all talking about the GIT_DISCOVERY_ACROSS_FILESYSTEM not set message. In my case our sys admin had decided that the apache2 directory needed to be on a mounted filesystem in case the disk for the server stopped working and had to get rebuilt. I found this with a simple df command:

跑过这个页面,几个喜欢它的人都在谈论 GIT_DISCOVERY_ACROSS_FILESYSTEM not set 消息。在我的例子中,我们的系统管理员已经决定 apache2 目录需要在一个挂载的文件系统上,以防服务器的磁盘停止工作而不得不重建。我用一个简单的 df 命令发现了这个:

-->  UBIk  <--:root@ns1:[/etc]
--PRODUCTION--(16:48:43)--> df -h
Filesystem                           Size  Used Avail Use% Mounted on
<snip>
/dev/mapper/vgraid-lvapache           63G   54M   60G   1% /etc/apache2
<snip>

To fix this I just put the following in the root user's shell (as they are the only ones who need to be looking at etckeeper revisions:

为了解决这个问题,我只是将以下内容放在 root 用户的 shell 中(因为他们是唯一需要查看 etckeeper 修订版的:

export GIT_DISCOVERY_ACROSS_FILESYSTEM=1

and all was well and good...much joy.

一切都很好……非常高兴。

More notes:

更多注意事项:

-->  UBIk  <--:root@ns1:[/etc]
--PRODUCTION--(16:48:54)--> export GIT_DISCOVERY_ACROSS_FILESYSTEM=0

-->  UBIk  <--:root@ns1:[/etc]
--PRODUCTION--(16:57:35)--> git status
On branch master
nothing to commit, working tree clean

-->  UBIk  <--:root@ns1:[/etc]
--PRODUCTION--(16:57:40)--> touch apache2/me

-->  UBIk  <--:root@ns1:[/etc]
--PRODUCTION--(16:57:45)--> git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    apache2/me

nothing added to commit but untracked files present (use "git add" to track)

-->  UBIk  <--:root@ns1:[/etc]
--PRODUCTION--(16:57:47)--> cd apache2

-->  UBIk  <--:root@ns1:[/etc/apache2]
--PRODUCTION--(16:57:50)--> git status
fatal: Not a git repository (or any parent up to mount point /etc/apache2)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
-->  UBIk  <--:root@ns1:[/etc/apache2]
--PRODUCTION--(16:57:52)--> export GIT_DISCOVERY_ACROSS_FILESYSTEM=1

-->  UBIk  <--:root@ns1:[/etc/apache2]
--PRODUCTION--(16:58:59)--> git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

    me

nothing added to commit but untracked files present (use "git add" to track)

Hopefully that will help someone out somewhere... -wc

希望这会在某个地方帮助某人...... -wc

回答by LSDeva

For complete the accepted answer, Had the same issue. First specified the remote

为了完成接受的答案,有同样的问题。首先指定遥控器

git remote add origin https://github.com/XXXX/YYY.git

git fetch 

Then get the code

然后获取代码

git pull origin master

回答by kumar

Check whether you are actually under a github repo.

检查您是否确实在 github 存储库下。

So, listing of .git/ should give you results..otherwise you may be some level outside your repo.

所以,列出 .git/ 应该会给你结果......否则你可能在你的仓库之外。

Now, cd to your repo and you are good to go.

现在, cd 到你的仓库,你就可以开始了。

回答by Kris Roofe

I came into this issue when I copy my local repository.

我在复制本地存储库时遇到了这个问题。

suod cp -r orginal_repo backup_repo
cd backup_repo
git status
fatal: Not a git repository (or any parent up to mount point /data)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

I've try git initas some answer suggested, but it not works.

我已经git init按照建议的答案尝试过,但它不起作用。

sudo git init
Reinitialized existing Git repository in /data/HQ/SC_Educations/hq_htdocs/HQ_Educations_bak/.git/

I solved it by change the owner of the repo

我通过更改 repo 的所有者解决了它

sudo chown -R www:www ../backup_repo

git status

状态

On branch develop

在分支上开发

nothing to commit, working directory clean

无需提交,工作目录干净

回答by BryanMinorPhD

The problem is you are not in the correct directory. A simple fix in Jupyter is to do the following command:

问题是您不在正确的目录中。Jupyter 中的一个简单修复是执行以下命令:

  1. Move to the GitHub directory for your installation
  2. Run the GitHub command
  1. 移动到 GitHub 目录进行安装
  2. 运行 GitHub 命令

Here is an example command to use in Jupyter:

这是在 Jupyter 中使用的示例命令:

%%bash
cd /home/ec2-user/ml_volume/GitHub_BMM
git show

Note you need to do the commands in the same cell.

请注意,您需要在同一单元格中执行命令。

回答by mick3dell

For android source code with repo, I beleive you should use REPO. if you really want to use git, you should know if the project has .git directory with ls -a. Or you have to enter the sub project directory which should include the .git.

对于带有 repo 的 android 源代码,我相信您应该使用 REPO。如果你真的想使用git,你应该知道项目是否有带有ls -a 的.git 目录。或者您必须输入应包含 .git 的子项目目录。