GIT_DISCOVERY_ACROSS_FILESYSTEM not set
GitFilesystemsBoundaryGit Problem Overview
I have searched and read few post but my problem is not the same as described. 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
fatal: Not a git repository (or any parent up to mount parent /home/kozi)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
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
Git Solutions
Solution 1 - Git
Just type git init
into your command line and press enter. Then run your command again, you probably were running git remote add origin [your-repository]
.
That should work, if it doesn't, just let me know.
Solution 2 - Git
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:
--> 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:
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
Solution 3 - Git
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
Solution 4 - Git
In short, git is trying to access a repo it considers on another filesystem and to tell it explicitly that you're okay with this, you must set the environment variable GIT_DISCOVERY_ACROSS_FILESYSTEM=1
I'm working in a CI/CD environment and using a dockerized git so I have to set it in that environment docker run -e GIT_DISCOVERY_ACROSS_FILESYSTEM=1 -v $(pwd):/git --rm alpine/git rev-parse --short HEAD\
'
If you're curious: Above mounts $(pwd) into the git docker container and passes "rev-parse --short HEAD" to the git command in the container, which it then runs against that mounted volums.
Solution 5 - Git
The below commands are to initialize git, add remote origin and to ser default upstream
git init
git remote add origin {REMOTE_URL}
git pull origin master
git branch --set-upstream-to=origin/master master
git pull
Solution 6 - Git
I came into this issue when I copy my local repository.
sudo cp -r original_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 init
as some answer suggested, but it doesn't work.
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
sudo chown -R www:www ../backup_repo
git status
# On branch develop
nothing to commit, working directory clean
Solution 7 - Git
Check whether you are actually under a github repo.
So, listing of .git/ should give you results..otherwise you may be some level outside your repo.
Now, cd to your repo and you are good to go.
Solution 8 - Git
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.
Solution 9 - Git
The problem is you are not in the correct directory. A simple fix in Jupyter is to do the following command:
- Move to the GitHub directory for your installation
- Run the GitHub command
Here is an example command to use in Jupyter:
%%bash
cd /home/ec2-user/ml_volume/GitHub_BMM
git show
Note you need to do the commands in the same cell.